CA SDM::.SPEL::. Substr

Document created by TMACUL Champion on Jan 25, 2017
Version 1Show Document
  • View in full screen mode


Overloaded method to return a string within a string

string substr(string str, int start, int length)

string substr(string str, int start) // reads to the end of the string for finish

Can be used in conjuction with sindex to retrieve start index.


string myString;

string otherString;

otherString = "this is a string";

myString = substr(otherString,sindex(otherString,"a"));

// myString == "a string"

myString = substr(otherString,sindex(otherString,"is",4));

// myString == "is a"

2 people found this helpful