VS:SubString: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (wasn't meant as susbstantive)
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Function SubString splits the Text string using characters specified in the Delemiters and returns the token located at the Index position. <BR>
Function SubString splits the Text string using characters specified in the var "Delimiter" and returns the token located at the Index position. <BR>
The first token is located at index 1. <BR>
The first token is located at index 1. <BR>
If there is an error the function returns ''(empty string).<BR>
If there is an error the function returns ''(empty string).<BR>
If index is less than 1 or grater than max number of tokens the function returns ''(empty string).</desc>
If index is less than 1 or greater than max number of tokens the function returns ''(empty string).</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Line 48: Line 48:
<sample>
<sample>
<code lang='vs'>
<code lang='vs'>
middleStr:=SubString('Left;Middle;Right',';',2);</code>
middleStr := SubString('Left;Middle;Right', ';', 2);</code>
</sample>
</sample>



Latest revision as of 06:20, 16 March 2017

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Function SubString splits the Text string using characters specified in the var "Delimiter" and returns the token located at the Index position.

The first token is located at index 1.
If there is an error the function returns (empty string).
If index is less than 1 or greater than max number of tokens the function returns (empty string).

FUNCTION SubString(
text :DYNARRAY[] of CHAR;
delimiter :STRING;
index :INTEGER) : DYNARRAY[] of CHAR;
def vs.SubString(text, delimiter, index):
    return DYNARRAY[] of CHAR

Parameters

text DYNARRAY[] of CHAR
delimiter STRING
index INTEGER

Example

middleStr := SubString('Left;Middle;Right', ';', 2);

Version

Availability: from Vectorworks 2014