Stuff

 

 

 

Stuff

 

Description

Inserts a string of characters into an existing string of characters and optionally replaces an existing string of characters.

 

Arguments

1.Stuff - Name of the Macro.

2.Base String - The complete string of characters into which the new string of characters will be inserted.

3.Start Index - Position to start inserting the new string of characters (0-based).

4.Length - The number of characters to remove from the existing string prior to inserting the new character string

5.Replacement - The new character string to insert (and optionally use to replace) into the base string.

 

Examples

 

<Stuff|The quick brown fox jumps over the lazy dog|4|5|slow>

Returns "The slow brown fox jumps over the lazy dog".

 

 

<Stuff|123456789|-2|0|.>

Returns "1234567.89".

 

<Stuff|123456789|-5|3|.>

Returns "1234.89".

 

Notes

The index for the start position is zero based, meaning that the first character is represented by 0, not 1. Only integers should be used for the start index and length. 

 

If the start value is 0 or greater the insert will be relative to the start of the string.  If the start index is less than 0 the insert will be relative to the end of the string. 

 

If the start value exceed the length of the base string the string will be padded appropriately on either the right for positive numbers or the left for negative numbers.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.