Lasso Soft Inc. > Home

[ string->merge ]

Method

[String->Merge] modifies the string object in-place by merging or inserting another string at a specified location. This tag requires two parameters and accepts several optional parameters.

The first parameter is the location in the base string at which to insert the merge string. A 1 specifies that the merge string should be inserted before the base string.

The second parameter is the string to merge.

An optional third parameter specifies an offset into the merge string. Only characters after the specified offset will be inserted into the base string. This parameter defaults to 1.

An optional fourth parameter specifies the number of characters from the merge string that should be inserted into the base string. This parameter defaults to the length of the merge string.

No characters from the base string will be replaced. The merge string will be inserted into the base string at the specified location, but the base string will remain intact before and after the merged string.

  • Syntax
'String Object'->merge(Offset Integer, 'Merge String')
'String Object'->merge(Offset Integer, 'Merge String', Merge Offset Integer)
'String Object'->merge(Offset Integer, 'Merge String', Merge Offset Integer, Merge Length Integer)
Examples
  • Beginner

To merge one string into another:

Use the [string->merge] method. The following example modifies the string object by inserting at the eleventh position a portion of the parameter string. The portion inserted begins with the eighth character and a total of six characters to insert. 

Code

local('s') = 'The quick rhino'
#s->merge(11,'purple white black', 8, 6)
#s

Result

The 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