12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

String methodsCharacters in a string are indexed from left to right. The index of the first character in a stringis 0, and the index of the last character is string.length-1.String methodsSyntaxstring.substring(start [ , end] )EffectReturns the substring of string starting at the index start and endingat the index end-1. If end is omitted, the tail of string is returned.Examples:"0123456".substring(0, 3) "012" "0123456".substring(2, 4) "23""0123456".substring(2) "23456"string.charAt(index)string.charCodeAt(index)Returns a one-character string containing the character at the specifiedindex of string. If index is out of range, an empty string is returned.Examples:"abcdef".charAt(0) "a" "abcdef".charAt(3) "d" "abcdef".charAt(100) ""Returns the ASCII code of the character at the specified index of string. Ifindex is out of range, returns NaN.Examples:"abcdef".charCodeAt(0) 97 "abcdef".charCodeAt(3) 100"abcdef".charCodeAt(100) NaNstring.indexOf(substring [ ,index ] )Returns the index in string of the first occurrence of substring. Stringis searched starting at index. If index is omitted, string is searched fromthe beginning. This method returns -1 if substring is not found.Examples:"abcdabcd".indexOf("bc") 1 "abcdabcd".indexOf("bc", 1) 1"abcdabcd".indexOf("bc", 2) 5 "abcdabcd".indexOf("bc", 10) -1"abcdabcd".indexOf("foo") -1 "abcdabcd".indexOf("BC") -1string.lastIndexOf(substring[ , index ] )Returns the index in string of the last occurrence of substring, whenstring is searched backwards, starting at index. If index is omitted,string is searched from the end. This method returns -1 if substringis not found.Examples:"abcdabcd".lastIndexOf("bc") 5 "abcdabcd".lastIndexOf("bc", 5) 5"abcdabcd".lastIndexOf("bc", 4) 1 "abcdabcd".lastIndexOf("bc", 0) -1"abcdabcd".lastIndexOf("foo") -1 "abcdabcd".lastIndexOf("BC") -1string.toLowerCase()Returns string converted to lowercase.226I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!