String内部函数-用于处理字符串
来源:互联网 发布:域名申请. 编辑:程序博客网 时间:2024/05/19 08:00
index 翻译-> 索引;
c和c++的index均由0开始,并非惯性思维的1;
index 函数
#include <string.h>main(){ char *s = "0123456789012345678901234567890";// 定义字符指针 char *p; p = index(s, '5');//index 函数查找s中‘5’,并返回其地址 printf("%s\n", p);}
//append追加函数string str1("Welcome")str1.append(" to come")//cout: "Welcome to come"str1.append(" to come",3,2)//cout:" Welcome c"// 3等价于index, n等价于2
//assgin 赋值函数string str1="world";str.assgin("hello");//cout:"hello"
//at(index) 返回index当前字符string str1="hello";str1.at(2); //retrun ‘l’
//clean 函数string str2=“hello”;str2.clean() //清除当前字符串
//erase(index,n) string str1="welcome"str1.erase(2,3)//cout:'weme'
//empty() 判断字符串是否为空string str1="welcome"str1.empty()// return 1;
//compare 比较两个字符串str1.compare(str2) //str1与str2比较
0 0
- String内部函数-用于处理字符串
- PHP 常用字符串内部函数 string functions
- python 字符串string 处理函数
- 常用字符串处理函数总结(string)
- C++库函数---<string.h>字符串处理函数
- PHP中String字符串处理函数完整版
- 字符串处理函数(string.h)
- C++ string类中的字符串处理函数
- String字符串处理的函数用法
- 字符串处理函数(string.h)
- Delphi反汇编内部字符串处理函数/过程不完全列表
- C++字符串string类提供的处理字符串的函数
- 字符串内部查找函数
- 字符串内部查找函数
- 字符串内部查找函数
- 正则表达式用于字符串处理
- C++ string函数 与 C字符串处理函数(整理)
- C++ string函数 与 C字符串处理函数(整理)
- zoj 3633 Alice's present
- C之运算符与强制类型转换
- TIPs
- 编译原理第五单元习题
- 黑马day18 juery的高级特性&Ajax的$.get()/post()方法
- String内部函数-用于处理字符串
- 各种操作符及其优先级
- #pragma once 和#ifndef ... #define ... #endif 比较
- php ci框架 里面使用 memcache 存 session
- 快速排序算法
- SVN合并(merge)的使用
- 剑指off-求链表终点节点
- poj1160 Post Office
- Goldengate Cache Manager(CACHEMGR)