Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 886 Bytes

File metadata and controls

36 lines (25 loc) · 886 Bytes

Home

High-powered ALLTRIM

Code:

DECLARE SHORT StrTrim IN Shlwapi As StrTrim;
   	STRING @ pszSource,;
   	STRING   pszTrimChars

lcSrc = "____//Turtle Soup/  "
	
* notice: three characters included in the list
* of characters to be trimmed
lcTrimChars = "_ /"

? "Before: ", "["+ lcSrc +"]"
= StrTrim (@lcSrc, lcTrimChars)
? "After:  ", "[" + LEFT(lcSrc, AT(Chr(0),lcSrc)-1) + "]"  

Listed functions:

StrTrim

Comment:

Unlike the native ALLTRIM, this function can remove not only blanks but any other characters included in the trim character list.

For example, to trim a text, surrounded with any combination of blanks, tabs and quotations, include in this list those three characters:
- space
- tab (Chr(9))
- "