我看过《女人不哭》
章子君的曲折生活,奋斗历程也让我更坚定的度过了那段日子。她最后还是成功了,事业and情感。从她身上,我学会:
坚强、忍耐、等待
LR_strchr and LR_strrchr
上一篇 /
下一篇 2007-09-04 08:39:48
/ 个人分类:LR_String Functions
一、strchr
char *strchr ( const char *string, int c );
string |
The string that is searched.
在哪个字符串进行寻找? |
c |
The character that is searched for in the string.
寻找哪个字符? |
strchr returns the pointer to the first occurrence of a character in a string.
strchr指向第一次出现寻找到的字符的位置
二、strrchr
(与strchr相对应的最后一个字符串)
char *strrchr ( const char *string, int c );
string |
The string that is searched. |
c |
The character that is searched for in the string. |
strrchr finds the last occurrence of a character in a string.
#include "web_api.h"
Action() {
char *string = "His Excellency txhe Duke of Exeter";
char *first_x, *last_x;
first_x = (char *)strchr(string, 'x');
lr_output_message("The first occurrence of x: %s", first_x);
last_x = (char *)strrchr(string, 'x');
lr_output_message("The last occurrence of x: %s", last_x);
return 0;
}
/*
这个函数的意义是:strchr:找出从字符串开始的第一个x字符,并把
这个x和x后面的字符全部显示出来
那么strrchr就是找到从给定字符串开始最后一个x字符,并把
最后这个x和它后面的字符全部显示出来
运行结果:
Action.c(11): The first occurrence of x: xcellency txhe Duke of Exeter
Action.c(13): The last occurrence of x: xeter
*/
收藏
举报
TAG:
LR_脚本