c语言string的函数
PS:本文包含了大部分strings函数的说明,并附带举例说明。本来想自己整理一下的,发现已经有前辈整理过了,就转了过来。修改了原文一些源码的问题,主要是用char *字义字符串的问题,导致程序运行时崩溃。另外自己重写了部分测试程序,使其更能满足自己测试的需要。不当之处,还请海涵。
@函数名称: sscanf
| 
 1 
2 
3 
 | 
char buf[512] = ;sscanf("123456 ", "%s", buf);printf("%s\n", buf); | 
2. 取指定长度的字符串。如在下例中,取最大长度为4字节的字符串。
| 
 1 
2 
 | 
sscanf("123456 ", "%4s", buf);printf("%s\n", buf); | 
3. 取到指定字符为止的字符串。如在下例中,取遇到空格为止字符串。
| 
 1 
2 
 | 
sscanf("123456 abcdedf", "%[^ ]", buf);printf("%s\n", buf); | 
4. 取仅包含指定字符集的字符串。如在下例中,取仅包含1到9和小写字母的字符串。
| 
 1 
2 
 | 
sscanf("123456abcdedfBCDEF", "%[1-9a-z]", buf);printf("%s\n", buf); | 
5. 取到指定字符集为止的字符串。如在下例中,取遇到大写字母为止的字符串。
| 
 1 
2 
 | 
sscanf("123456abcdedfBCDEF", "%[^A-Z]", buf);printf("%s\n", buf); | 
6、给定一个字符串iios/12DDWDFF@122,获取 / 和 @ 之间的字符串,先将 "iios/"过滤掉,再将非'@'的一串内容送到buf中
| 
 1 
2 
 | 
sscanf("iios/12DDWDFF@122", "%*[^/]/%[^@]", buf);printf("%s\n", buf) | 
7、给定一个字符串"hello, world",仅保留"world"。(注意:“,”之后有一空格)
| 
 1 
2 
 | 
sscanf(“hello, world”, "%*s%s", buf);printf("%s\n", buf); | 
P.S. %*s表示第一个匹配到的%s被过滤掉,即hello被过滤了,
如果没有空格则结果为NULL。[2]
@函数原型: char *strdup(const char *s)
函数功能: 字符串拷贝,目的空间由该函数分配
函数返回: 指向拷贝后的字符串指针
参数说明: src-待拷贝的源字符串
所属文件: <string.h>
- #include <stdio.h>
 - #include <string.h>
 - #include <alloc.h>
 - int main()
 - {
 - char *dup_str, *string="abcde";
 - dup_str=strdup(string);
 - printf("%s", dup_str);
 - free(dup_str);
 - return 0;
 - }
 
@函数名称: strcpy
函数原型: char* strcpy(char* str1,char* str2);
函数功能: 把str2指向的字符串拷贝到str1中去
函数返回: 返回str1,即指向str1的指针
参数说明:
所属文件: <string.h>
- #include <stdio.h>
 - #include <string.h>
 - int main()
 - {
 - char string[10];
 - char *str1="abcdefghi";
 - strcpy(string,str1);
 - printf("the string is:%s\n",string);
 - return 0;
 - }
 
@函数名称: strncpy
函数原型: char *strncpy(char *dest, const char *src,intcount)
函数功能: 将字符串src中的count个字符拷贝到字符串dest中去
函数返回: 指向dest的指针
参数说明: dest-目的字符串,src-源字符串,count-拷贝的字符个数
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - int main()
 - {
 - char*src = "bbbbbbbbbbbbbbbbbbbb";//20 'b's
 - char dest[50] ="aaaaaaaaaaaaaaaaaaaa";//20 'a's
 - puts(dest);
 - strncpy(dest, src, 10);
 - puts(dest);
 - return0;
 - }
 
输出:
- /*******************************************
 - aaaaaaaaaaaaaaaaaaaa
 - bbbbbbbbbbaaaaaaaaaa
 - *******************************************/
 
注意:strncpy只复制指定长度的字符,不会自动在末尾加'\0'。若指定长度超过源字符串长度,不够的部分补‘\0’,
@函数名称: strcat
函数原型: char* strcat(char * str1,char * str2);
函数功能: 把字符串str2接到str1后面,str1最后的'\0'被取消
函数返回: str1
参数说明:
所属文件: <string.h>
- #include <stdio.h>
 - #include <string.h>
 - int main()
 - {
 - char buffer[80];
 - strcpy(buffer,"Hello ");
 - strcat(buffer,"world");
 - printf("%s\n",buffer);
 - return 0;
 - }
 
@函数名称: strncat
函数原型: char *strncat(char *dest, const char *src, size_t maxlen)
函数功能: 将字符串src中前maxlen个字符连接到dest中
函数返回:
参数说明:
所属文件: <string.h>
- #include <stdio.h>
 - #include <string.h>
 - char buffer[80];
 - int main()
 - {
 - strcpy(buffer,"Hello ");
 - strncat(buffer,"world",8);
 - printf("%s\n",buffer);
 - strncat(buffer,"*************",4);
 - printf("%s\n",buffer);
 - return 0;
 - }
 
注意:与strncpy不同的是,strncat会自动在末尾加‘\0’,若指定长度超过源字符串长度,则只复制源字符串长度即停止
@函数名称: strcmp
函数原型: int strcmp(char * str1,char * str2);
函数功能: 比较两个字符串str1,str2.
函数返回: str1<str2,返回负数;str1=str2,返回 0;str1>str2,返回正数.
参数说明:
所属文件: <string.h>
- #include <string.h>
 - #include <stdio.h>
 - int main()
 - {
 - char *buf1="aaa", *buf2="bbb",*buf3="ccc";
 - int ptr;
 - ptr=strcmp(buf2, buf1);
 - if(ptr>0)
 - printf("buffer 2 is greater thanbuffer 1\n");
 - else
 - printf("buffer 2 is less thanbuffer 1\n");
 - ptr=strcmp(buf2, buf3);
 - if(ptr>0)
 - printf("buffer 2 is greater thanbuffer 3\n");
 - else
 - printf("buffer 2 is less thanbuffer 3\n");
 - return 0;
 - }
 
@函数名称: strncmp
函数原型: int strncmp(char *str1,char *str2,int count)
函数功能: 对str1和str2中的前count个字符按字典顺序比较
函数返回: 小于0:str1<str2,等于0:str1=str2,大于0:str1>str2
参数说明: str1,str2-待比较的字符串,count-比较的长度
所属文件: <string.h>
- #include<string.h>
 - #include<stdio.h>
 - int main()
 - {
 - char str1[] ="aabbc";//
 - char str2[] = "abbcd";//
 - //为使测试程序更简练,此处假定了strncmp只返回-1,0,1三个数
 - char res_info[] = {'<','=','>'};
 - int res;
 - //前1个字符比较
 - res = strncmp(str1, str2, 1);
 - printf("1:str1%c str2\n", res_info[res+1]);
 - //前3个字符比较
 - res = strncmp(str1, str2, 3);
 - printf("3:str1%c str2\n", res_info[res+1]);
 - }
 
输出:
- /****************************************
 - 1:str1= str2
 - 3:str1< str2
 - *****************************************/
 
@函数名称: strpbrk
函数原型: char *strpbrk(const char *s1, const char *s2)
函数功能: 得到s1中第一个“同时也出现在s2中”字符的位置指针
函数返回: 位置指针
参数说明:
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - int main()
 - {
 - char *p="Find all vowels";
 - p=strpbrk(p+1,"aeiouAEIOU");
 - while(p)
 - {
 - printf("%s\n",p);
 - p=strpbrk(p+1,"aeiouAEIOU");
 - }
 - return 0;
 - }
 
输出:
- /**************************************
 - ind all vowels
 - all vowels
 - owels
 - els
 - **************************************/
 
@函数名称: strcspn
函数原型: int strcspn(const char *s1, const char *s2)
函数功能: 统计s1中从头开始直到第一个“来自s2中的字符”出现的长度
函数返回: 长度
参数说明:
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - int main()
 - {
 - printf("%d\n",strcspn("abcbcadef","cba"));
 - printf("%d\n",strcspn("xxxbcadef","cba"));
 - printf("%d\n",strcspn("123456789","cba"));
 - return 0;
 - }
 
输出:
- /************************
 - 0
 - 3
 - 9
 - ************************/
 
@函数名称: strspn
函数原型: int strspn(const char *s1, const char *s2)
函数功能: 统计s1中从头开始直到第一个“不来自s2中的字符”出现的长度
函数返回: 位置指针
参数说明:
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - #include<alloc.h>
 - int main()
 - {
 - printf("%d\n",strspn("abcbcadef","cba"));
 - printf("%d\n",strspn("xxxbcadef","cba"));
 - printf("%d\n",strspn("123456789","cba"));
 - return 0;
 - }
 
输出:
- /************************
 - 6
 - 0
 - 0
 - ************************/
 
@函数名称: strchr
函数原型: char* strchr(char* str,char ch);
函数功能: 找出str指向的字符串中第一次出现字符ch的位置
函数返回: 返回指向该位置的指针,如找不到,则返回空指针
参数说明: str-待搜索的字符串,ch-查找的字符
所属文件: <string.h>
- #include<string.h>
 - #include<stdio.h>
 - int main()
 - {
 - char *str = "This is a string!";
 - char ch;
 - char *p;
 - while(1)
 - {
 - printf("Please input a char:");
 - ch = getchar();
 - p = strchr(str, ch);
 - if(p)
 - printf("%c is the %d character of\"%s\"\n",ch, (int)(p-str+1),str);
 - else
 - printf("Not found!\n");
 - printf("Press ESC to quit!\n\n");
 - if(27 == getch())
 - break;
 - fflush(stdin);
 - }
 - return 0;
 - }
 
运行结果:
- /********************************************
 - Please input achar:i
 - i is the 3character of "This is a string!"
 - Press ESC to quit!
 - Please input achar:l
 - Not found!
 - Press ESC to quit!
 - Please input achar:s
 - s is the 4character of "This is a string!"
 - Press ESC to quit!
 - **********************************************/
 
@函数名称: strrchr
函数原型: char *strrchr(const char *s, int c)
函数功能: 得到字符串s中最后一个含有c字符的位置指针
函数返回: 位置指针
参数说明:
所属文件: <string.h>
- #include<string.h>
 - #include<stdio.h>
 - int main()
 - {
 - charstring[15];
 - char*ptr,c='r';
 - strcpy(string,"This is a string");
 - ptr=strrchr(string,c);
 - if (ptr)
 - printf("The character %c is at position:%d",c,ptr-string);
 - else
 - printf("The character was not found");
 - return 0;
 - }
 
@函数名称: strstr
函数原型: char* strstr(char* str1,char* str2);
函数功能: 找出str2字符串在str1字符串中第一次出现的位置(不包括str2的串结束符)
函数返回: 返回该位置的指针,如找不到,返回空指针
参数说明:
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - int main()
 - {
 - char*str1="Open Watcom C/C++",*str2="Watcom",*ptr;
 - ptr=strstr(str1,str2);
 - printf("The substring is:%s\n",ptr);
 - return 0;
 - }
 
输出:
The substringis:Watcom C/C++
@函数名称: strrev
函数原型: char *strrev(char *s)
函数功能: 将字符串中的所有字符颠倒次序排列
函数返回: 指向s的指针
参数说明:
所属文件: <string.h>
- #include<string.h>
 - #include<stdio.h>
 - int main()
 - {
 - char forward[]="string"; //原文中定义为char*是不对的,指向代码段的指针内容是不可变的
 - printf("Before strrev():%s",forward);
 - strrev(forward);
 - printf("Afterstrrev(): %s",forward);
 - return 0;
 - }
 
输出:
- /************************************
 - Beforestrrev():string
 - After strrev():gnirts
 - ************************************/
 
@函数名称: strnset
函数原型: char *strnset(char *s, int ch, size_t n)
函数功能: 将字符串s中前n个字符设置为ch的值
函数返回: 指向s的指针
参数说明:
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - int main()
 - {
 - charstring[]="aaaaaaaaaaaaaaaaaaaaaaa";
 - char letter='x';
 - printf("string before strnset:%s\n",string);
 - strnset(string,letter,10);
 - printf("string after strnset: %s\n",string);
 - return 0;
 - }
 
输出:
- /*************************************************
 - string beforestrnset: aaaaaaaaaaaaaaaaaaaaaaa
 - string afterstrnset: xxxxxxxxxxaaaaaaaaaaaaa
 - *************************************************/
 
@函数名称: strset
函数原型: char *strset(char *s, int ch)
函数功能: 将字符串s中所有字符设置为ch的值
函数返回: 指向s的指针
参数说明:
所属文件: <string.h>
- #include<stdio.h>
 - #include<string.h>
 - int main()
 - {
 - charstring[10]="123456789";
 - charsymbol='c';
 - printf("Before strset(): %s", string);
 - strset(string, symbol);
 - printf("After strset(): %s", string);
 - return 0;
 - }
 
@函数名称: strtok
函数原型: char *strtok(char *s1, const char *s2)
函数功能: 分解s1字符串为用特定分隔符分隔的多个字符串(一般用于将英文句分解为单词)
函数返回: 字符串s1中首次出现s2中的字符前的子字符串指针
参数说明: s2一般设置为s1中的分隔字符
规定进行子调用时(即分割s1的第二、三及后续子串)第一参数必须是NULL
在每一次匹配成功后,将s1中分割出的子串位置替换为NULL(摘下链中第一个环),因此s1被破坏了
函数会记忆指针位置以供下一次调用
所属文件: <string.h>
- #include<string.h>
 - #include<stdio.h>
 - int main()
 - {
 - char *p;
 - char*buffer;
 - char*delims={ " .," };
 - buffer=strdup("Find words, all of them.");
 - printf("%s\n",buffer);
 - p=strtok(buffer,delims);
 - while(p!=NULL){
 - printf("word: %s\n",p);
 - p=strtok(NULL,delims);
 - }
 - printf("%s\n",buffer);
 - return 0;
 - }//根据测试,可以随时给strtok的第一个参数输入一个新的字符串,开始新字符串的分隔
 
PS:根据测试,可以随时给strtok的第一个参数输入一个新的字符串,开始新字符串的分隔
@函数名称: strupr
函数原型: char *strupr(char *s)
函数功能: 将字符串s中的字符变为大写
函数返回:
参数说明:
所属文件: <string.h>
- #include <stdio.h>
 - #include <string.h>
 - int main()
 - {
 - char string[]="abcdefghijklmnopqrstuvwxyz",*ptr; //会影响原字符串的内存,用char[]来声明
 - ptr=strupr(string);
 - printf("%s",ptr);
 - return 0;
 - }
 
@函数名称: strlwr
函数原型: char *strlwr(char *s)
函数功能: 将字符串中的字符变为小写字符
函数返回: 指向s的指针
参数说明:
所属文件: <string.h>
- #include<string.h>
 - int main()
 - {
 - char str[]="HOW TO SAY?";
 - printf("%s",strlwr(str));
 - return 0;
 - }
 
@函数名称: strerror
函数原型: char *strerror(int errnum)
函数功能: 得到错误信息的内容信息
函数返回: 错误提示信息字符串指针
参数说明: errnum-错误编号
所属文件: <string.h>
- #include <stdio.h>
 - #include <errno.h>
 - int main()
 - {
 - char *buffer;
 - buffer=strerror(errno);
 - printf("Error: %s",buffer);
 - return 0;
 - }
 
@函数名称: memcpy
函数原型: void *memcpy(void *dest, const void *src, size_t n)
函数功能: 字符串拷贝
函数返回: 指向dest的指针
参数说明: src-源字符串,n-拷贝的最大长度
所属文件: <string.h>,<mem.h>
- #include <stdio.h>
 - #include <string.h>
 - int main()
 - {
 - char src[]="******************************";
 - char dest[]="abcdefghijlkmnopqrstuvwxyz0123456709";
 - char *ptr;
 - printf("destination before memcpy:%s\n",dest);
 - ptr=memcpy(dest,src,strlen(src));
 - if (ptr)
 - printf("destination after memcpy:%s\n",dest);
 - else
 - printf("memcpy failed");
 - return 0;
 - }
 
输出:
- /*************************************************************
 - destination before memcpy:abcdefghijlkmnopqrstuvwxyz0123456709
 - destination after memcpy:******************************456709
 - **************************************************************/
 
@函数名称: memccpy
函数原型: void *memccpy(void *dest, const void *src, int c, size_t n)
函数功能: 字符串拷贝,到指定长度或遇到指定字符时停止拷贝
函数返回:
参数说明: src-源字符串指针,c-中止拷贝检查字符,n-长度,dest-拷贝底目的字符串指针
所属文件: <string.h>,<mem.h>
- #include <string.h>
 - #include <stdio.h>
 - int main()
 - {
 - char *src="This is the source string";
 - char dest[50];
 - char *ptr;
 - ptr=memccpy(dest,src,'c',strlen(src));
 - if (ptr)
 - {
 - *ptr='\0';
 - printf("The character wasfound:%s",dest);
 - }
 - else
 - printf("The character wasn'tfound");
 - return 0;
 - }
 
输出:
- /*****************************************
 - The character was found:This is the sourc
 - *****************************************/
 
PS:指定字符被复制到dest中,memccpy返回了dest中指定字符的下一处的地址,返回NULL表示未遇到指定字符
@函数名称: memchr
函数原型: void *memchr(const void *s, int c, size_t n)
函数功能: 在字符串中第开始n个字符中寻找某个字符c的位置
函数返回: 返回c的位置指针,返回NULL时表示未找到
参数说明: s-要搜索的字符串,c-要寻找的字符,n-指定长度
所属文件: <string.h>,<mem.h>
- #include <string.h>
 - #include <stdio.h>
 - int main()
 - {
 - char str[17];
 - char *ptr;
 - strcpy(str,"This is a string");
 - ptr=memchr(str,'r',strlen(str));
 - if (ptr)
 - printf("The character 'r' is at position:%d",ptr-str);
 - else
 - printf("The character was not found");
 - return 0;
 - }
 
@函数名称: memcmp
函数原型: int memcmp(const void *s1, const void *s2,size_t n)
函数功能: 按字典顺序比较两个串s1和s2的前n个字节
函数返回: <0,=0,>0分别表示s1<,=,>s2
参数说明: s1,s2-要比较的字符串,n-比较的长度
所属文件: <string.h>,<mem.h>
- #include <stdio.h>
 - #include <string.h>
 - int main()
 - {
 - char *buf1="ABCDE123";
 - char *buf2="abcde456";
 - int stat;
 - stat=memcmp(buf1,buf2,5);
 - printf("The strings to position 5 are");
 - if(stat) printf("not ");
 - printf("the same\n");
 - return 0;
 - }
 
@函数名称: memicmp
函数原型: int memicmp(const void *s1, const void *s2, size_t n)
函数功能: 按字典顺序、不考虑字母大小写对字符串s1,s2前n个字符比较
函数返回: <0,=0,>0分别表示s1<,=,>s2
参数说明: s1,s2-要比较的字符串,n-比较的长度
所属文件: <string.h>,<mem.h>
- #include <stdio.h>
 - #include <string.h>
 - int main()
 - {
 - char *buf1="ABCDE123";
 - char *buf2="abcde456";
 - int stat;
 - stat=memicmp(buf1,buf2,5);
 - printf("The strings to position 5 are");
 - if(stat) printf("not");
 - printf("the same");
 - return 0;
 - }
 
输出:
- /**************************************
 - The strings to position 5 are the same
 - ***************************************/
 
@函数名称: memmove
函数原型: void *memmove(void *dest, const void *src, size_t n)
函数功能: 字符串拷贝
函数返回: 指向dest的指针
参数说明: src-源字符串,n-拷贝的最大长度
所属文件: <string.h>,<mem.h>
- #include <string.h>
 - #include <stdio.h>
 - int main()
 - {
 - chardest[40]="abcdefghijklmnopqrstuvwxyz0123456789";
 - printf("destination prior tomemmove:%s\n",dest);
 - memmove(dest+1,dest,35);
 - printf("destination aftermemmove:%s",dest);
 - return 0;
 - }
 
PS:与memcpy不同的是,memmove可以处理目的字符串与源字符串地址空间出现重叠的情况,可保证待复制的内容不被破坏。
@函数名称: memset
函数原型: void *memset(void *s, int c, size_t n)
函数功能: 字符串中的n个字节内容设置为c
函数返回:
参数说明: s-要设置的字符串,c-设置的内容,n-长度
所属文件: <string.h>,<mem.h>
- #include <string.h>
 - #include <stdio.h>
 - #include <mem.h>
 - int main()
 - {
 - charbuffer[]="Hello world";
 - printf("Buffer before memset:%s/n",buffer);
 - memset(buffer,'*',strlen(buffer)-1);
 - printf("Buffer after memset:%s",buffer);
 - return 0;
 - }
 
c语言string的函数的更多相关文章
- Atitit java方法引用(Method References) 与c#委托与脚本语言js的函数指针
		
Atitit java方法引用(Method References) 与c#委托与脚本语言js的函数指针 1.1. java方法引用(Method References) 与c#委托与脚本语言js ...
 - C语言字符串匹配函数
		
C语言字符串匹配函数,保存有需要时可以用: #include <stdio.h> #include <stdlib.h> #include <string.h> # ...
 - 转:C语言字符串操作函数 - strcpy、strcmp、strcat、反转、回文
		
转自:C语言字符串操作函数 - strcpy.strcmp.strcat.反转.回文 C++常用库函数atoi,itoa,strcpy,strcmp的实现 作者:jcsu C语言字符串操作函数 1. ...
 - Java之--Java语言基础组成—函数
		
Java语言基础组成-函数 Java语言由8个模块构成,分别为:关键字.标识符(包名.类名.接口名.常量名.变量名等).注释.常量和变量.运算符.语句.函数.数组. 本片主要介绍Java中的函数,函数 ...
 - php入门  数据类型  运算符  语言结构语句  函数  类与面向对象
		
php PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them ...
 - Go语言基础之函数
		
Go语言基础之函数 函数是组织好的.可重复使用的.用于执行指定任务的代码块.本文介绍了Go语言中函数的相关内容. 函数 Go语言中支持函数.匿名函数和闭包,并且函数在Go语言中属于“一等公民”. 函数 ...
 - Atiitt 使用java语言编写sql函数或存储过程
		
Atiitt 使用java语言编写sql函数或存储过程 1.1. java编写sql函数或存储过程的机制1 1.2. Java编写sp的优点1 1.3. 支持java源码,class文件,blog f ...
 - golang学习笔记13 Golang 类型转换整理 go语言string、int、int64、float64、complex 互相转换
		
golang学习笔记13 Golang 类型转换整理 go语言string.int.int64.float64.complex 互相转换 #string到intint,err:=strconv.Ato ...
 - [日常] Go语言圣经-匿名函数习题
		
Go语言圣经-匿名函数1.拥有函数名的函数只能在包级语法块中被声明,通过函数字面量(function literal),我们可绕过这一限制,在任何表达式中表示一个函数值2.通过这种方式定义的函数可以访 ...
 
随机推荐
- PandorBox 中安装aria2失败的解决办法
			
来自:http://www.right.com.cn/forum/thread-174358-1-1.html 不论luci界面还是opkg中安装,都提示缺少依赖包uclibc,pandorabox默 ...
 - 用VC生成 IDispatch 包装类
			
1.创建包装类:View->ClassWizard->Add Class->Add Class From ActiveX Control Wizard 2 .选中Registry 3 ...
 - Docker系列(六):Docker网络机制(下)
			
Linux Namespace详解 namespace:是一个空间,空间里可以放进程,文件系统,账号,网络等,某个资源被放到namespace之后 别人就看不到他了. 可以看到有两个namespace ...
 - Laravel5.4中自定义404等错误页面
			
1.在resources/views/下简历文件夹error,在error文件中建立"404.blade.php文件". <!DOCTYPE html PUBLIC &quo ...
 - PHP面向对象之继承的基本思想
			
图例 概念和说明 代码展示 <?php header('content-type:text/html;charset=utf-8'); //学生考试系统 class Student{ publi ...
 - Caused by: java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
			
报错信息 Error starting ApplicationContext. To display the auto-configuration report re-run your applica ...
 - USACO 2007 February Silver The Cow Lexicon /// DP oj24258
			
题目大意: 输入w,l: w是接下来的字典内的单词个数,l为目标字符串长度 输入目标字符串 接下来w行,输入字典内的各个单词 输出目标字符串最少删除多少个字母就能变成只由字典内的单词组成的字符串 Sa ...
 - SUMMARY | JAVA中的数据结构
			
String String类是不可修改的,创建需要修改的字符串需要使用StringBuffer(线程同步,安全性更高)或者StringBuilder(线程非同步,速度更快). 可以用“+”连接Stri ...
 - LoadRunner如何调用外部函数
			
LoadRunner如何调用外部函数 使用 VuGen 时,可以调用在外部 DLL 中定义的函数.通过从脚本调用外部函数,可以降低脚本的内存使用量以及总体运行时间.要调用外部函数,需要加载定义了该函数 ...
 - 位运算 - 左移右移运算符 >>, <<,  >>>
			
1-左移运算符m<<n,表示把m左移n位.左移n位的时候,最左边的n位数将被丢弃,同时在最右边补上n个0.例如: 00001010<<2 = 00101000 10001010 ...