Goto main content

ltrim

Eliminates whitespace from the beginning of a string.

LTRIM

NAME

ltrim - Eliminates whitespace from the beginning of a string.

SYNOPSIS

ltrim(string,charlist)

DESCRIPTION

This function is used to eliminate characters (from a defined set) from the left side of a string. Without the second parameter, characters from these groups will be trimmed:

  • " " (ASCII 32 (0x20)), an ordinary space.
  • "\t" (ASCII 9 (0x09)), a tab.
  • "\n" (ASCII 10 (0x0A)), a new line (line feed).
  • "\r" (ASCII 13 (0x0D)), a carriage return.
  • "\x0B" (ASCII 11 (0x0B)), a vertical tab.

It will return the string without the characters that were eliminated.

PARAMETERS

string
The string that will be trimmed. charlist This is optional. The characters that are going to be trimmed can be specified using this parameter. The user only has to list all characters that have to be eliminated. With "..", one can specify a range in which the character to be trimmed could be. For example, if one says ltrim(charlist:"x0..9,x0x89"), it will trim all the x from the string.

RETURN

string
The trimmed string.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

in: res={_{ltrim("   caroline")}}
out:res=caroline

in: res={_{ltrim(charlist:"o0..9","o0aaa098")}}
out: res=0aaa098

in: res={_{ltrim(charlist:"o0..9","o0aaao098")}}
out: res=0aaa098

in: res={_{ltrim(charlist:"o0..9","o0aaa98o")}}
out: res= 0aaa98o

The last o is not trimmed since it is out of the range.

in:  res={_{ltrim(charlist:"ò0..9","òóaaaÓ098")}}.
out: res=óaaaÓ098.

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey and Caroline Laplante, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.