Lasso Soft Inc. > Home

[ String->RemoveLeading ]

Method

[String->RemoveLeading] removes all instances of the parameter from the beginning of the string. Modifies the string and returns no value. The method takes two forms.

The first form requires a single string parameter. The pattern is not case sensitive.

The second form requires a regular expression parameter.

  • Syntax
'String Object'->removeleading('String Pattern')
'String Object'->removeleading('Regular Expression')
Examples
  • Beginner
  • Intermediate

To remove a string pattern from the beginning of a string:

Use the [String->RemoveLeading] method. The following example removes the characters "The " from the beginning of a string, then outputs the string.

Code

local('s') = 'The quick white rhino'
#s->removeleading('The ')
#s

Result

quick white rhino

To remove a string pattern using a regular expression from the beginning of a string:

Use the [String->RemoveLeading] method. The following example removes 1-3 alphabetic characters followed by a white space character from the beginning of a string, then outputs the string.

Code

local('s') = 'The quick white rhino'
#s->removeleading(regexp('[a-zA-Z]{1,3}\\s'))
#s

Result

quick white rhino

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft