Substring

 

 

 

Substring

 

Description

Retrieves a substring of characters from within a base string.

 

Arguments

1.Substring - Name of the Macro.

2.Base String - The complete string of characters from which the substring will be taken.

3.Start Index - Position to start taking the substring (0-based).  Position must be >= 0.  This is basically the number of characters to skip over.

4.Length - Length or number of characters to take from the base string.  If not supplied, the macro will take all of the characters from the start position to the end of the string.

 

Examples

[Substring|Jimmy cracked corn|6|7]

Returns "cracked".

 

[Substring|Accounts Receivable|9]

Returns "Receivable".

 

[Substring|ABCDEF|1|-2]

Returns "BCD" after skipping 1 character from the beginning of the string and stripping off two characters from the end.

 

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. This macro can produce similar results to the Left and Right macro.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.