public class StringFunctions extends Object
Constructor and Description |
---|
StringFunctions() |
Modifier and Type | Method and Description |
---|---|
ListHolder |
find(ExecutionContext ctx,
String string,
String patternStr)
Finds all occurrences of the regexp in the specified string.
|
String |
format(ExecutionContext ctx,
String pattern,
Object... arguments)
Returns a formatted string using the specified format string and
arguments.
|
String |
formatWithLocale(ExecutionContext ctx,
String pattern,
String locale,
Object... arguments)
Returns a formatted string using the specified format string and
arguments.
|
Decimal |
indexOf(ExecutionContext ctx,
String string,
String substring)
Returns the index of the first occurrence of the specified substring
within the string.
|
Decimal |
indexOf(ExecutionContext ctx,
String string,
String substring,
Decimal fromIndex)
Returns the index of the first occurrence of the specified substring
within the string, starting at the specified index.
|
boolean |
isBlank(ExecutionContext ctx,
String string)
Return
true if the string is either null or only consists of whitespaces. |
boolean |
isEmpty(ExecutionContext ctx,
String string)
Returns
true if the string is either null or has zero length (contains no characters). |
Decimal |
lastIndexOf(ExecutionContext ctx,
String string,
String substring)
Returns the index of the rightmost occurrence of the specified substring
within the string.
|
Decimal |
lastIndexOf(ExecutionContext ctx,
String string,
String substring,
Decimal fromIndex)
Returns the index of the last occurrence of the specified substring
within the string, searching backward starting at the specified index.
|
Decimal |
length(ExecutionContext ctx,
String string)
Returns the length of String
|
String |
localize(ExecutionContext ctx,
String string,
String language)
Returns the original string with all localizable strings replaced by
their translation.
|
boolean |
matches(ExecutionContext ctx,
String string,
String regexp)
Check method to find out if given string matches regex
|
String |
replaceAll(ExecutionContext ctx,
String string,
String regexp,
String replacement)
Replaces each substring of the string parameter that matches the regular
expression given by the regexp parameter with the string specified as the
replacement parameter.
|
String |
replaceFirst(ExecutionContext ctx,
String string,
String regexp,
String replacement)
Replaces the first substring of the string that matches the regular
expression given by the regexp parameter with the string specified as the
replacement parameter.
|
ListHolder |
split(ExecutionContext ctx,
String string,
String regexp)
Splits the string around matches of regular expression given by the
regexp parameter.
|
ListHolder |
splitPathname(ExecutionContext ctx,
String name)
Splits a fully specified element name to names of it components which are
separated by the namespace separator (::).
|
String |
substring(ExecutionContext ctx,
String string,
Decimal fromIndex,
Decimal toIndex)
Returns a substring of the string
|
Decimal |
toDecimal(ExecutionContext ctx,
String string)
If possible, converts the string parameter to a decimal value.
|
Decimal |
toInteger(ExecutionContext ctx,
String string)
Converts String value using 10 radix to long
|
Decimal |
toInteger(ExecutionContext ctx,
String string,
Decimal radix)
Converts a given string value to integer using a given radix.
|
String |
toLowerCase(ExecutionContext ctx,
String string)
Converts all characters of the specified string to lower case.
|
String |
toLString(String moduleHash,
String identifier,
String... arguments)
Deprecated.
usage of this function was replaced by
LocalizationOperation |
String |
toString(ExecutionContext ctx,
Object object)
Converts object to String using
Object.toString() method |
String |
toString(ExecutionContext ctx,
Object object,
Boolean expandRecords)
Converts object to String using
Object.toString() method. |
String |
toUpperCase(ExecutionContext ctx,
String string)
Converts all characters of the string to upper case.
|
String |
trim(ExecutionContext ctx,
String string)
Returns a copy of the string, with leading and trailing white space
omitted.
|
public Decimal length(ExecutionContext ctx, String string) throws ErrorException
ctx
- string
- ErrorException
public Decimal toInteger(ExecutionContext ctx, String string) throws ErrorException
ctx
- string
- ErrorException
public Decimal toInteger(ExecutionContext ctx, String string, Decimal radix) throws ErrorException
ctx
- string
- radix
- ErrorException
public Decimal toDecimal(ExecutionContext ctx, String string) throws ErrorException
ctx
- string
- ErrorException
public String toString(ExecutionContext ctx, Object object)
Object.toString()
methodctx
- object
- public String toString(ExecutionContext ctx, Object object, Boolean expandRecords)
Object.toString()
method. If
object is instance of ValueHolder
, it will use
ToStringBuilder.toString(Object,boolean)
ctx
- object
- expandRecords
- public boolean matches(ExecutionContext ctx, String string, String regexp) throws ErrorException
ctx
- regexp
- - pattern expressionstring
- - valueErrorException
@Deprecated public String toLString(String moduleHash, String identifier, String... arguments)
LocalizationOperation
moduleHash
- identifier
- arguments
- public String format(ExecutionContext ctx, String pattern, Object... arguments) throws ErrorException
ctx
- pattern
- arguments
- ErrorException
public String formatWithLocale(ExecutionContext ctx, String pattern, String locale, Object... arguments) throws ErrorException
ctx
- pattern
- locale
- arguments
- ErrorException
public String replaceAll(ExecutionContext ctx, String string, String regexp, String replacement) throws ErrorException
Pattern
class) is used.ctx
- string
- regexp
- replacement
- ErrorException
public String replaceFirst(ExecutionContext ctx, String string, String regexp, String replacement) throws ErrorException
Pattern
class) is used.ctx
- string
- regexp
- replacement
- ErrorException
public ListHolder split(ExecutionContext ctx, String string, String regexp) throws ErrorException
Pattern
class) is used.ctx
- string
- regexp
- ErrorException
public String trim(ExecutionContext ctx, String string) throws ErrorException
ctx
- string
- ErrorException
public boolean isEmpty(ExecutionContext ctx, String string) throws ErrorException
true
if the string is either null or has zero length (contains no characters).ctx
- string
- true
if the string is either null or has zero length (contains no characters)ErrorException
public boolean isBlank(ExecutionContext ctx, String string) throws ErrorException
true
if the string is either null or only consists of whitespaces.ctx
- string
- true
if the string is either null or only consists of whitespacesErrorException
public String substring(ExecutionContext ctx, String string, Decimal fromIndex, Decimal toIndex) throws ErrorException
ctx
- string
- fromIndex
- toIndex
- ErrorException
public String localize(ExecutionContext ctx, String string, String language) throws ErrorException
ctx
- string
- not localized stringlanguage
- ErrorException
public Decimal indexOf(ExecutionContext ctx, String string, String substring) throws ErrorException
ctx
- string
- substring
- ErrorException
public Decimal indexOf(ExecutionContext ctx, String string, String substring, Decimal fromIndex) throws ErrorException
ctx
- string
- substring
- fromIndex
- ErrorException
public Decimal lastIndexOf(ExecutionContext ctx, String string, String substring) throws ErrorException
ctx
- string
- substring
- ErrorException
public Decimal lastIndexOf(ExecutionContext ctx, String string, String substring, Decimal fromIndex) throws ErrorException
ctx
- string
- substring
- fromIndex
- ErrorException
public String toUpperCase(ExecutionContext ctx, String string) throws ErrorException
ctx
- string
- ErrorException
public String toLowerCase(ExecutionContext ctx, String string) throws ErrorException
ctx
- string
- ErrorException
public ListHolder find(ExecutionContext ctx, String string, String patternStr) throws ErrorException
ctx
- string
- patternStr
- ErrorException
public ListHolder splitPathname(ExecutionContext ctx, String name) throws ErrorException
splitPathname("module::'role 1'")
results in
["module", "role 1"]
.ctx
- name
- ErrorException
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.