String functions
StringFind ()
StringGetChar ()
StringLen ()
StringSetChar ()
StringSubstr ()
StringTrimLeft ()
StringTrimRight ()
int StringFind (string text, string matched_text, int start = 0)
Search this string for the first match on substrings.
Parameters
text - String to search.
matched_text - search strings.
start - Starting index in the string.
Sample
string text = "The quick brown dog jumps over the lazy fox";
int index;
Index = StringFind (text, "dog jumps, 0);
if (indeks! = 16)
Print ("Oops!");
int StringGetChar (string text, int pos)
Returns character (code) from certain position in the array.
Parameters
text - string where the character will be revealed.
POS - Shar zero based position in the array.
Sample
int char_code;
char_code = StringGetChar ("abcdefgh", 3);
/ / "C" char code is 99
int StringLen (string text)
Returns character count of string.
Parameters
text - string to calculate the length.
Sample
string str = "some text";
if (StringLen (str) <5) return (0);
StringSetChar string (string text, int pos, int value)
Returns a string copy with changes in the character position indicated by a new value.
Parameters
text - String where the character will change.
POS - Zero based character position in array. It can be from 0 to StringLen () -1.
value - New ASCII character code.
Sample
string str = "abcdefgh";
string str1 = StringSetChar (str, 3, "D");
/ / Str1 is "abcDefgh"
StringSubstr string (string text, int start, int count = empty)
Excerpts from text string substring, starting position (zero-based).
The function returns a copy of the extracted substring if possible, otherwise return empty string.
Parameters
text - String of substring will be extracted.
start - starting index Substring
count - Character counts.
Sample
string text = "The quick brown dog jumps over the lazy fox";
string substr = StringSubstr (text, 4, 5);
/ / Strip series is a "quick" word
StringTrimLeft string (string text)
Call the function to trim leading white space characters from a string. StringTrimLeft removes new line, space and tab characters. The function returns a copy of the trimmed string if possible, otherwise return empty string. Returns a string with new changes.
Parameters
text - String to lower left.
Sample
string str1 = "Hello World";
string str2 = StringTrimLeft (str);
/ / POST trimming the str2 variable will be "Hello World"
StringTrimRight string (string text)
Call the function to trim leading white space characters from a string. StringTrimRight removes new line, space and tab characters. The function returns a copy of the trimmed string if possible, otherwise return empty string.
Parameters
text - String to trim right.
Sample
string str1 = "Hello World";
string str2 = StringTrimRight (str);
/ / POST trimming the str2 variable will be "Hello World"
Friday, May 27, 2011
Subscribe to:
Post Comments (Atom)



0 comments:
Post a Comment