four:
来源:互联网 发布:淘宝充值平台退款 编辑:程序博客网 时间:2024/04/30 06:29
atoi :
函数名: atoi
功 能: 把字符串转换成整型数
函数说明: atoi()会扫描参数nptr字符串,检测到第一个数字或正负符号时开始做类型转换,之后检测到非数字或结束符 /0 时停止转换,返回整型数。
用 法: int atoi(const char *nptr);
需要用到的头文件: #include <stdlib.h>
程序例:
1)
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int n;
char *str = "12345.67";
n = atoi(str);
printf("string = %s integer = %d/n", str, n);
return 0;
}
执行结果
string = 12345.67 integer = 12345
2)
#include <stdlib.h>
#include <stdio.h>
int mian()
{
char a[] = "-100" ;
char b[] = "123" ;
int c ;
c = atoi( a ) + atoi( b ) ;
printf("c = %d/n", c) ;
return 0;
}
执行结果
c = 23
strrchr
strrchr() 函数
Definition and Usage
定义和用法
The strrchr() function finds the position of the last occurrence of a string within another string, and returns all characters from this position to the end of the string.
strrchr()函数的作用是:查找一个字符串在另一个字符串中末次出现的位置,并返回从字符串中的这个位置起,一直到字符串结束的所有字符。
If char cannot be found, this function returns FALSE.
如果未能找到指定字符,那么函数将返回False。
Syntax
语法
strrchr(string,char) |
Parameter参数 | Description描述 |
---|---|
string | Required. Specifies the string to search 必要参数。指定需要进行搜索的字符串 |
char | Required. Specifies the string to find. If this is a number, it will search for the character matching the ASCII value of that number 必要参数。指定需要查找的字符对象。如果是一个数字,那么他将搜索与这个数字对应的ASCII值相匹配的字符 |
Tips and Notes
提示
Tip: This function is binary safe.
提示:这个函数是二进制精确的。
Example 1
案例1
<?phpecho strrchr("Hello world!","world");?> |
The output of the code above will be:
上述代码将输出下面的结果:
world! |
Example 2
案例2
In this example we will search a string for the ASCII value of "o":
在下的案例中,我们将输入“o”的ASCII值:
<?phpecho strrchr("Hello world!",111);?> |
The output of the code above will be:
上述代码将输出下面的结果:
orld! |
- four:
- four
- four
- four friends
- unit four
- Four ugliness
- Four Sum
- Twenty-four
- four数组
- hibernate four
- Week Four
- code fragment Four from
- The four number game
- Snow For Four Years
- gang of four resources
- The Four Quadrant Leadership
- Ubuntu four Components
- Layer Four Traceroute
- 今夜,让我静静的想你
- 当网站不允许上传asp cer cdx htr文件时
- 篇首记:迷茫与奋进
- BlockStructure
- java数据结构
- four:
- 2008-7-23
- Berkeley DB
- .net中前台javascript与后台c#相互调用
- VMware 怎样扩展虚拟磁盘的空间
- Hello China V1.5 源码下载地址
- 从后台拿到webshell
- 一生中必看的30个故事
- 入侵渗透思路