String functions

String functions. More...

Functions

 asc (char)
 Returns the decimal value of a char.

 chr (dec_no)
 Returns the character corresponding to a decimal value in ASCII table.

 lcase (astring)
 Convert to lower case.

 ucase (astring)
 Convert to upper case.

 pos (substring, string)
 Search a substring in a string.

 trim (string)
 Trims a string.

 mid (string, start, char_no)
 Return a part of a string.

 del (string, start, char_no)
 Delete a part of a string.

 len (string)
 Return length of a string.

 split (string, substring)
 Split a string.

 extract (token_no)
 Return a token resulted after a split.

 tohex (astring)
 Format a string in hexadecimal.


Detailed Description

String functions.


Function Documentation

asc char   ) 
 

Returns the decimal value of a char.

Returns the decimal value of the char.

Parameters:
char 
Example
writelog(asc("a"))
prints in log "97"

chr dec_no   ) 
 

Returns the character corresponding to a decimal value in ASCII table.

Returns the character corresponding to the decimal value no, which must be less then 256, in ASCII table

Parameters:
dec_no decimal value between 0 and 255
Example
writelog(chr(97))
prints in log "a"

del string  ,
start  ,
char_no 
 

Delete a part of a string.

Delete a char_no number of characters starting at start from string.
Must be used in an assignment , see example (returns a new string).

Parameters:
string Source string
start Start position
char_no How many characters to delete
Example
mystring=del("my big string",1,3)
writelog(mystring)
prints in log "big string"

extract token_no   ) 
 

Return a token resulted after a split.

Returns token_no string resulted from splitting a string with split function.

Parameters:
string 
Example
s="a|s|c"
l=split(s,"|")
for (i,1,l,1)
writelog(extract(i))
next

lcase astring   ) 
 

Convert to lower case.

Returns the string with all characters in lower case.

Parameters:
astring String to be converted
Example
writelog(lcase ("My String"))
prints in log "my string"

len string   ) 
 

Return length of a string.

Returns the number of characters of the string.

Parameters:
string 
Example
writelog(len("my big string"))
prints in log "13"

mid string  ,
start  ,
char_no 
 

Return a part of a string.

Returns the string's substring starting at start with a length of char_no.

Parameters:
string Source string
start Start position
char_no How many characters to return
Example
midstring=mid("my big string",4,3)
writelog(midstring)
prints in log "big"

pos substring  ,
string 
 

Search a substring in a string.

Returns the position of the first substring's character in the string.
If the substring is not found in string will return 0.

Parameters:
substring Substring to search for
string In what string to search
Example
position=pos("string","my string")
writelog(position)
prints in log "4"

split string  ,
substring 
 

Split a string.

Splits string in tokens delimited by substring.
Returns the number of tokens. The tokens are remembered until next split.

Parameters:
string String to be split
substring Delimiter substring
Note:
Use it with extract() function

tohex astring   ) 
 

Format a string in hexadecimal.

Return a hexadecimal formatted string, each character followed by a space.

Parameters:
astring String to be formated

trim string   ) 
 

Trims a string.

Returns string with all leading and ending spaces and control characters deleted.

Parameters:
string String to be trimmed
Example
trimedstring=trim(" my string "&chr(13)&chr(10)) #has spaces
writelog (trimedstring)
prints in log "my string", without spaces

ucase astring   ) 
 

Convert to upper case.

Returns the string with all characters in upper case.

Parameters:
astring String to be converted
Example
writelog(ucase ("My String"))
prints in log "MY STRING"


Generated on Wed Dec 3 10:18:42 2003 for Easy Control