
RASExpress User Guide
178 CommPlete Communications Server
STRCMP strcmp(string first_string, second_string) : integer;
Compares first_string to second_string. If they are the same, 0 is returned. If first_string
is less than second_string (i.e., earlier in the alphabet or number line), a negative value
is returned; otherwise a positive value is returned.
Example
See strlen command.
STRCPY strcpy(var string target_string, source_string);
Copies source_string to target_string. If there is any error in copying, 0 is returned;
otherwise 1 is returned.
Example
See strlen command.
STRFMT strfmt(var string buffer, string format_string {, integer | real | string argument})
➥ : integer;
Formats the arguments according to format_string and copies to buffer. There should
be a one-to-one correspondence between the format control characters in the format
string and the provided arguments. If a provided argument does not match the cor-
responding format control character, it is ignored in the conversion. The number of
converted arguments is returned. For a detailed description of the format control
characters, see “Format String and Format Control Characters” on page 151.
Example
See strlen command.
STRLEN strlen(string buffer) : integer;
Returns the string length of buffer.
Example
/* This script illustrates the strlen, strcat, strcmp, */
/* strcpy, and strfmt commands. */
proc main;
string str;
string tail;
string str1;
string str2;
str = "test string";
display("Example of strlen command^J^M");
fdisplay("str value is : %s^J^Mlength of the string is
➥ %d^J^M", str, strlen(str));
display("Example of strcat command^J^M");
fdisplay("str value is : %s^J^M", str);
tail = " for strcat";
fdisplay("str value after concatenating with ‘%s’ is
➥ : ^J^M", tail);
strcat(str, tail);
fdisplay("%s^J^M^J^M", str);
display("Example of strcmp command^J^M");
str1 = "string";
Comentarios a estos manuales