>> Strings
____________________________

LEN(s)- length of string
SPC(n)/SPACE(n)- returns a string of 'n' spaces
BIN(x)- binary string-value of x
OCT(x)- octal string-value of x
HEX(x)- hexadecimal string-value of x
VAL(s)- numeric value of string s
STR(x)- convert x to string
ASC(s)- ASCII code of first character of s
CHR(x)- returns one-char string of character with
ASCII code x
____________________________

LOWER(s), UPPER(s)
or
LCASE(s), UCASE(s)

Converts the string s to lower/upper case

Example:
? LOWER("Hi"):REM hi
? UPPER("Hi"):REM HI
____________________________

LTRIM(s)- Removes leading white-spaces from string s
RTRIM(s)- Removes /trailing white-spaces from string s
TRIM(s)- Removes leading/trailing white-spaces from string s

Example:

? LEN(LTRIM(" Hi")):REM 2

TRIM is equal to LTRIM(RTRIM(s))
____________________________

SQUEEZE(s)

Removes the leading/trailing and duplicated white-spaces

Example:
?"["; SQUEEZE(" Hi there ");"]"

Result:
[Hi there]
____________________________

ENCLOSE(str[, pair])

Encloses a string.
The default pair is ""

Example:
? enclose("abc","()")

Result:
(abc)
____________________________

DISCLOSE(str[, pairs [, ignore-pairs]])

Discloses a string.

Default pairs and ignore pairs

First
non white-space
character Check Ignore
--------------------------------------------
"""''
'''""
(()""''
[[]""''
{{}""''
<<>""''

Otherwise:
"""''

Example:

s ="abc (abc)"
? s; tab(26); disclose(s,"()")
' prints abc

s ="abc (a(bc))"
? s; tab(26); disclose(s,"()"); tab(40); disclose(disclose(s,"()"),"()")
' prints a(bc), bc

s ="abc (a='(bc)')"
? s; tab(26); disclose(s,"()","''"); tab(40);&
disclose(disclose(s,"()","''"),"()","''")
' prints a='(bc)', nothing
____________________________

LEFT(s[,n]), RIGHT(s[,n])

Returns the n number of leftmost/rightmost chars of string s
If n is not specified, the SB uses 1
____________________________

LEFTOF(s1,s2),
RIGHTOF(s1,s2)

Returns the left/right part of s1 at the position of the first
occurrence of the string s2 into string s1

Note: s2 does not included on new string.
____________________________

LEFTOFLAST(s1,s2),
RIGHTOFLAST(s1,s2)

Returns the left/right part of s1 at the position of the last
occurrence of the string s2 into string s1

Note: s2 does not included on new string.
____________________________

MID(s, start [,length])

Returns the part (length) of the string s starting from 'start'
position

If the 'length' parameter is omitted, MID returns the whole string
from the position 'start'.
____________________________

INSTR([start,] s1, s2)

Returns the position of the first occurrence of the string s2 into
string s1 (starting from the position 'start')

If there is no match, INSTR returns 0
____________________________

RINSTR([start,] s1, s2)

Returns the position of the last occurrence of the string s2 into
string s1 (starting from the position 'start')

If there is no match, RINSTR returns 0
____________________________

REPLACE(source, pos, str [, len])

Writes the 'str' into 'pos' of 'source' and returns the new string.

This function replaces only 'len' characters. The default value of
'len' is the length of 'str'.

Examples:

s="123456"

' Cut
? replace(s,3,"",len(s))

' Replace
? replace(s,2,"bcd")

' Insert
? replace(s,3,"cde",0)

' Replace & insert
? replace(s,2,"RRI",2)
____________________________

TRANSLATE(source, what [, with])

Translates all occurrences of the string 'what' found in the 'source'
with the string 'with' and returns the new string.

Example:

? Translate("Hello world","o","O")
' displays: HellO wOrld

____________________________

STRING(len,{ascii|str})

Returns a string that is contains 'len' times of string 'str' or the
character 'ascii'.
____________________________

FORMAT(format, val)

Returns a formated string.

Numbers:
# Digit or space

0 Digit or zero

^ Stores a number in exponential format.
Unlike QB's USING format this is a place-holder like the #.

. The position of the decimal point.

, Separator.

- Stores minus if the number is negative.

+ Stores the sign of the number.

Strings:
& Stores a string expression without reformatting it.

! Stores only the first character of a string expression.

\\ Stores only the first n + 2 characters of a string
expression, where n is the number of spaces between the
two backslashes.
Unlike QB, there can be literals inside the \\. These
literals are inserted in the final string.

Example:

? FORMAT("#,##0", 1920.6): REM prints 1,921
? FORMAT("\-\","abcde"): REM prints "abc-de"
____________________________

SPRINT var;[USING...;]...

Create formated string and storing it to var

The syntax is the same with the PRINT command.

Example:

SPRINT s; 12.34; TAB(12); 11.23;
____________________________

SINPUT src; var [, delim][,var [, delim]]...

Splits the string 'src' into variables which are separated by
delimiters.

Example:

SINPUT "if x>1 then y"; vif,"", vcond,"then", vdo
? vcond, vdo
' result in monitor
' x>1 y
____________________________

SPLIT string, delimiters, words()[, pairs][USE expr]

Returns the words of the specified string into array 'words'

Example:

s="/etc/temp/filename.ext"

SPLIT s,"/.", v()
FOR i=0 TO UBOUND(v)
PRINT i;"[";v(i);"]"
NEXT

displays:
0 []
1 [etc]
2 [temp]
3 [filename]
4 [ext]
____________________________

JOIN words(), delimiters, string

Returns the words of the specified string into array 'words'

Example:

s="/etc/temp/filename.ext"

SPLIT s,"/.", v()
JOIN v(),"/", s
PRINT "[";s;"]"

displays:
[/etc/temp/filename/ext]


____________________________

