LoadRunner中截取字符串

	/*strchr和strrchr的区别*/

	char *strTest1="citms citms";

	char *strTest2,*strTest3;

	strTest2=(char *)strchr(strTest1,'t'); //在strTest1中顺序查找字符t,当第一次碰到t的时候开始往后截取。

	lr_output_message("the first occurrence of t :%s ",strTest2);

	strTest3=(char *)strrchr(strTest1,'t'); //在strTest1中倒叙查找字符t,当第一次碰到t的时候开始往后截取。

	lr_output_message("the last occurrence of t :%s",strTest3);

	/*strcpy和strncpy,memcpy的区别*/

	char *strTest1="citms citms";

	char strTest4[50],strTest5[50];

 
strcpy(strTest4,strTest1); //将strTest1的内容复制到strTest4里面。 lr_output_message("%s",strTest4); strncpy(strTest5,strTest1,4); //将strTest1的内容,从开始截取4位,复制到strTest5里面 lr_output_message("%s",strTest5);
  strcpy(strTest4,"abc\0abc");  //在字符串中“\0”代表结束字符,所以下面代码里strTest4为abc lr_output_message("%s",strTest4);  
strncpy(strTest5,"abc\0abc",6); lr_output_message("%s",strTest5); //通过memcpy函数,可以识别“\0”后面的字符,下面代码结果为 //abc //def memcpy(strTest5,"abc\0def",7); lr_output_message("%s",strTest5); lr_output_message("%s",strTest5+4);

	/*strcmp和stricmp的区别*/

	char strTest6[50]="How old are you?";

	char *strTest7;

	int result;

	strTest7="HOW old are you?";

	result=strcmp(strTest6,strTest7);

	lr_output_message("%d",result);

 
result=stricmp(strTest6,strTest7); lr_output_message("%d",result); //返回数字1,为前一个字符串大于后一个 //返回数字0,为前一个字符串等于后一个 //返回-1,为前一个字符串小于后一个 //strcmp是区分大小写的比较,stricmp是不区分大小写的比较

	/*strcat和strncat的区别*/

	char strTest8[50];

	char *strTest9="is LiLei.";

	strcpy(strTest8,"My name ");

	strcat(strTest8,strTest9);

	lr_output_message("%s",strTest8);

	strncat(strTest8,strTest9,5);

	lr_output_message("%s",strTest8);
	

char *stringTest="abc\0abc";

int stringlength=0;

lr_output_message("%s",stringTest);

stringlength=strlen(stringTest);

lr_output_message("%d",stringlength);

LoadRunner中截取字符串的更多相关文章

  1. SQL Server中截取字符串常用函数

    SQL Server 中截取字符串常用的函数: .LEFT ( character_expression , integer_expression ) 函数说明:LEFT ( '源字符串' , '要截 ...

  2. shell中截取字符串的方法总结

    shell中截取字符串的方法有很多种, ${expression}一共有9种使用方法. ${parameter:-word} ${parameter:=word} ${parameter:?word} ...

  3. SqlServer中截取字符串

    SQL Server 中截取字符串常用的函数: .LEFT ( character_expression , integer_expression ) 函数说明:LEFT ( '源字符串' , '要截 ...

  4. SQL Server 中截取字符串常用的函数

    SQL Server 中截取字符串常用的函数: 1.LEFT ( character_expression , integer_expression ) 函数说明:LEFT ( '源字符串' , '要 ...

  5. sql server中截取字符串的常用函数

    我们如果要在sql server中,使用截取字符串的方法要怎样使用呢? sql server提供了3个常用截取字符串方法,LEFT().RIGHT().SUBSTRING() /****** Sql ...

  6. 在LoadRunner中转换字符串大小写的C语言函数

    在LoadRunner中转换字符串大小写的C语言函数 . loadrunner语言ccharacterstringaction 封装ConvertToXXX函数: //ConvertToUpper f ...

  7. linux 中截取字符串

    shell中截取字符串的方法有很多中,${expression}一共有9种使用方法.${parameter:-word}${parameter:=word}${parameter:?word}${pa ...

  8. C#中截取字符串的几种方法

      1.根据单个分隔字符用split截取 例如 复制代码代码如下: string st="GT123_1"; string[] sArray=st.split("_&qu ...

  9. sql和access中截取字符串的区别

    一向对数据库不熟悉,今天又遇到简单而又被忽略的问题——字符串的截取. 在Excel处理数据过程中,我们常用substring,left,mid,right来截取字符:在.NET编程中,我们常用subs ...

随机推荐

  1. Java Thread.join()方法

    一.使用方式. join是Thread类的一个方法,启动线程后直接调用,例如: Thread t = new AThread(); t.start(); t.join(); 二.为什么要用join() ...

  2. code vs1517 求一次函数解析式(数论 纯数学知识)

    1517 求一次函数解析式  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题解  查看运行结果     题目描述 Description 相信大家都做过练 ...

  3. 【DPM】Deformable Part Models matlab代码在windows下的调试过程

    我下载的是voc-release5 1.按照这篇文章,都操作了一遍:http://blog.csdn.net/pozen/article/details/7023742#quote 2.运行demo不 ...

  4. 【linux】nohup运行守护进程

    来源:http://www.cnblogs.com/allenblogs/archive/2011/05/19/2051136.html nohup 命令 用途:不挂断地运行命令. 语法:nohup ...

  5. bootstrap日期控件在火狐下的模态框中选择时间下拉菜单无效的解决办法

    今天收到程序组提交的一个兼容BUG,在火狐中使用模态框加载日期控件时选择时间下拉菜单没有效果(不能点击),而在谷歌中却是好的, 排错思路:1,在当前页面主层放置一个时间控件,测试通过 2,在ajax加 ...

  6. 如何查看设备的 UDID

    手机连接上电脑,打开 Xcode,确认手机已连上: command+shift+2,就可以查看到 UDID 了:

  7. August 30th 2016 Week 36th Tuesday

    If you keep on believing, the dreams that you wish will come true. 如果你坚定信念,就能梦想成真. I always believe ...

  8. C --gettimeofday===获取某个程序经历的时间

    #include <stdio.h> #include <sys/time.h> #include <time.h> int gettimeofday(struct ...

  9. MetaWeblog博客客户端工具之Windows Live Writer

    吐槽&注意的坑: 刚听说了有这么一个东西,据说Windows Live Writer开源之后就改名为Open Live Writer,我以为Open Live Writer就要比Windows ...

  10. 三、jQuery--jQuery基础--jQuery基础课程--第6章 jQuery 事件与应用

    1.页面加载时触发ready()事件 ready()事件类似于onLoad()事件,但前者只要页面的DOM结构加载后便触发,而后者必须在页面全部元素加载成功才触发,ready()可以写多个,按顺序执行 ...