StrTrim

Removes leading and trailing blanks from a character string.

Syntax:

StrTrim(string[,flags])

Parameters:

(s) string: a string with unwanted spaces at the beginning and/or end

(i) flags: (optional) specifies where spaces will be removed, see below

Returns:

(s) string devoid of leading and/or trailing spaces, depending on flag value.

 

This function removes spaces and tab characters from the beginning and end of a text string.

 

Flags

value

meaning

1

Remove space and tabs from left-hand side of string

2

Remove space and tabs from right-hand side of string

3

Remove space and tabs from both sides of string.

Default action if value not specified.

Example:


mydata = ""
While mydata != "exit"
   mydata = AskLine("STRTRIM", "Type stuff ('cancel' quits)", "", 0)
   mydata = StrTrim(mydata)
   Display(4,"STRTRIM",">%mydata%<")
EndWhile
Exit
See Also:

StrInsert, StrFill, StrFix, StrLen, StrOverlay, StrTrimChar