strltrim()

Removes certain characters from a string, beginning from left.

Synopsis

string strltrim(string s [, string trimstr]);

Parameters

Parameter Description
s A string, from which characters are removed.
trimstr List of characters to be removed. This is an optional parameter and if the parameter is not specified, blank spaces, tabs, line feeds etc. as leading characters of s are removed.

Return value

A shortened string

Errors

Missing or incorrect arguments

Description

Removes the characters contained in the string trimstr from left to right from the string s and returns the shortened string s. As soon as a character occurs, on comparison, in s, that does not occur in trimstr, the operation is ended. If trimstr is empty or not a string, the unshortened string s is returned. trimstr is optional, by default a trim string comprising white spaces is used. Blank spaces, tabs, line feeds etc. as leading characters of s are removed.

Note that the second parameter of this function defines a list of characters to be removed and not a string, which should be removed!

Example

Removes "ETM" from "ETMWinCCOA" and returns "WinCCOA". The function removes characters from the string until a character that is not on the list, is found.

main()
{
  string res;
  res=strltrim("ETMWinCCOA", "ETM");
  DebugN("Shortened string:", res);
  }

Assignment

Strings

Availability

CTRL