String manipulation and query functions.
concat( strings, ... )
s1+s2+...
, but this method makes sure that
values are converted to strings, with the blank value invisible.
strings
(Object, one or more): one or more strings
join( separator, words, ... )
separator
(String): string to insert between adjacent words
words
(Object, one or more): one or more values to join
separator
equals( s1, s2 )
s1==s2
,
which can (for technical reasons) return false even if the
strings are the same.
s1
(String): first string
s2
(String): second string
equalsIgnoreCase( s1, s2 )
s1
(String): first string
s2
(String): second string
startsWith( whole, start )
whole
(String): the string to test
start
(String): the sequence that may appear at the start of
whole
whole
are
the same as start
endsWith( whole, end )
whole
(String): the string to test
end
(String): the sequence that may appear at the end of
whole
whole
are
the same as end
contains( whole, sub )
whole
(String): the string to test
sub
(String): the sequence that may appear within whole
sub
appears within
whole
length( str )
str
(String): string
str
split( words )
The result is an array of strings, and if you want to use the
individual elements you need to use square-bracket indexing,
with [0]
representing the first object
words
(String): string with embedded spaces delimiting the words
split( words, regex )
The result is an array of strings, and if you want to use the
individual elements you need to use square-bracket indexing,
with [0]
representing the first object
words
(String): string with multiple parts
regex
(String): regular expression delimiting the different words in
the words
parameter
matches( str, regex )
str
(String): string to test
regex
(String): regular expression string
regex
matches str
anywhere
matchGroup( str, regex )
str
(String): string to match against
regex
(String): regular expression containing a grouped section
regex
didn't match str
)
replaceFirst( str, regex, replacement )
str
(String): string to manipulate
regex
(String): regular expression to match in str
replacement
(String): replacement string
str
, but with the first match (if any) of
regex
replaced by replacement
replaceAll( str, regex, replacement )
str
(String): string to manipulate
regex
(String): regular expression to match in str
replacement
(String): replacement string
str
, but with all matches of
regex
replaced by replacement
substring( str, startIndex )
str
(String): the input string
startIndex
(integer): the beginning index, inclusive
str
, omitting the first
startIndex
characters
substring( str, startIndex, endIndex )
startIndex
and continues to the character at index endIndex-1
Thus the length of the substring is endIndex-startIndex
.
str
(String): the input string
startIndex
(integer): the beginning index, inclusive
endIndex
(integer): the end index, inclusive
str
toUpperCase( str )
str
(String): input string
str
toLowerCase( str )
str
(String): input string
str
trim( str )
str
(String): input string
padWithZeros( value, ndigit )
value
(long integer): numeric value to pad
ndigit
(integer): the number of digits in the resulting string
value
with
at least ndigit
characters