STR.Trim

Previous  Next

 

string = STR.Trim( InString  AS STRING, 

                   nSide     AS INTEGER = EL_STR_LEFT, 

                   Targets   AS STRING  = NULL ) AS STRING

 


 

Trims characters from left and/or right side of the supplied string.  The Targets string contains the target characters to be trimmed.  If the Targets parameter is ommited, the function removes newline, space, and tab characters.

 

The following constants have been defined in MyBASIC2_ExtLib.bis

 

CONST EL_STR_LEFT                = 0x00000001

CONST EL_STR_RIGHT               = 0x00000002

CONST EL_STR_BOTH                = 0x00000003

 

Example:

 

DIM strLine AS STRING

 

strLine = "   This is no joke   "

strLine = STR.Trim( strLine, EL_STR_BOTH )

 

PRINT "(";strLine;")",

 

' Resulting output

(This is no joke)