Character Classification and Conversion Functions

上一篇 / 下一篇  2012-06-04 16:47:04 / 个人分类:LoadRunner

Character Classification and Conversion Functions

 

Character Classification and Conversion functions allow you to convert characters within a string. Expand the category to view a list of the available functions.

Click one of the following functions for more information:

Function Name

Description

tolower

Converts a string to lowercase.

toupper

Converts a string to uppercase.

isdigit

Checks if a string is a decimal digit.

isalpha

Checks if a string is a letter.

 

例子

char character_set[]={'A','5','$','z','c'};

int i;

//将所有字符转换为大写

for (i=0;i<5;i++) {

        lr_output_message("%c ",toupper(character_set[i]));

}

//将所有字符转换为小写

for (i=0;i<5;i++) {

lr_output_message("%c ",tolower(character_set[i]));

        }

 

例子

//Checks if a string is a decimal digit (characters `0' to `9').

if(isdigit(55))

        lr_output_message("The value 55 is the digit %c",55);

else

        lr_output_message("Value 55 is not a digit. It's the character %c",55);

////Checks if a string is a decimal digit (characters `0' to `9').

if(isdigit(109))

        lr_output_message("The value 109 is the digit %c",109);

else

        lr_output_message("Value 109 is not a digit. It's the character %c.",109);

 

//The function isalpha checks to see if the value of interger falls within the ranges A - Z or a - z.

if(isalpha(107))

        lr_output_message("The value 107 is %c",107);

else

        lr_output_message("Value 107 is not alphabetic.It's the digit %d",107);

//The function isalpha checks to see if the value of interger falls within the ranges A - Z or a - z.

if(isalpha(22))

        lr_output_message("The value 22 is %c",22);

else

        lr_output_message("The value 22 is not alphabetic. It's the digit %d",22);

 


TAG:

 

评分:0

我来说两句

Open Toolbar