我们使用字符串时经常要对字符串中单个字符进行处理,比如检测一个string对象是否包含空白,或者把string对象中的字母大写改为小写,查看某个特定字符是否出现,判断字符串是否为数字等等。
这类处理的关键是要获取字符本身。有时需要处理string对象中的每一个字符,另外一些时候则只需处理某个特定的字符,还有些时候遇到某个条件处理就要停下来。
在cctype头文件中定义了一组标准库函数处理字...
分类:
其他好文 时间:
2015-04-21 22:55:52
阅读次数:
112
find the first unique character in a string and you can just traverse this string only one time. if there is no such character, just return '#' and '#' will not appear in the string, else return the ...
分类:
其他好文 时间:
2015-04-21 22:53:16
阅读次数:
167
#include
#include
#include
#pragma comment(lib,"ws2_32.lib")
std::string GetLocalIpAndSave(void)
{
WSADATA wsaData;
char name[155];
std::string strIp;
PHOSTENT hostinfo;
if ( WSAStartup( MAK...
分类:
其他好文 时间:
2015-04-21 22:50:41
阅读次数:
174
1 #define _CRT_SECURE_NO_WARNINGS 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 class MyString { 9 10 public : 11...
分类:
其他好文 时间:
2015-04-21 22:35:12
阅读次数:
235
关键代码:public class jbalistener implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { // TODO 自动生成的方法存根 String str...
分类:
其他好文 时间:
2015-04-21 22:33:15
阅读次数:
143
/** * 打印杨辉三角 功能描述:使用多重循环打印6阶杨辉三角 * @author Administrator * */public class sz_7 { public static void main(String[] args) { Scanner in = new Scanner(S.....
分类:
编程语言 时间:
2015-04-21 22:29:18
阅读次数:
244
#include#include#include#includeusing namespace std;char a[1000+100];int vis[1000+100];int n;int cnt;int ok;bool huiwen(){ int l=0; int r=strlen...
分类:
其他好文 时间:
2015-04-21 22:13:32
阅读次数:
125
public class Books { private String book_no; private String book_name; private String book_author; private String release_time; private...
分类:
编程语言 时间:
2015-04-21 22:09:07
阅读次数:
186
面试题三:查找二维数组中元素问题public static void main(String[] args){ int[][] num = {{1,2,8,9},{2,4,9,12},{4,7,10,13},{6,8,11,15}}; search(num,7); } public ...
分类:
编程语言 时间:
2015-04-21 22:04:06
阅读次数:
143
关键代码:try { String str=Chat.getJt().getText().toString();//获取输入内容 String[] ipstr=str.split("[.]"); byte[] by=new byte[4]; for(int i=0;i<4;i++){ int m.....
分类:
编程语言 时间:
2015-04-21 22:03:48
阅读次数:
144