new OString(value)
Creates a new OString, setting its value to the specified string.
It is highly recommended to use the static factory instead as it is optimised and
more flexible.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | The value of this |
Members
-
<static, constant, non-null> EMPTY :olympe.df.OString
-
Type:
-
<static, constant, non-null> SPACE :olympe.df.OString
-
Type:
Methods
-
<static> Concat(pOStr1, pOStr2)
-
Constructs a new
OStringby concatenating the 2 strings passed as parameters.Parameters:
Name Type Description pOStr1olympe.df.POString | string the first part of the string
pOStr2olympe.df.POString | string the second part of the string
Returns:
the concatenation of the 2 strings
- Type
- olympe.df.POString
-
<static> concat(strings)
-
Concatenate all the strings passed as parameter and returns the result as a new OString or POString.
Parameters:
Name Type Argument Description stringsolympe.df.OString | olympe.df.Proxy.<olympe.df.OString> | string <repeatable>
The strings to concatenate to this one
Returns:
A new string containing the result of the concatenation
- Type
- olympe.df.POString
-
<static> currentStringValue(p)
-
Returns the current value of a string. The argument can be an
OString, aNodeor aProxy<OString>.Parameters:
Name Type Description polympe.df.POString | string | olympe.df.Node the string
Returns:
the value as a primitive string
- Type
- string
-
<static> fromJSON(json)
-
Deserializes an
OStringfrom a JSON object or string.Parameters:
Name Type Description jsonstring | Object Returns:
- Type
- olympe.df.OString
-
concat(strings)
-
Concatenate this string with all the strings in an array and returns the result as a new OString.
Parameters:
Name Type Argument Description stringsolympe.df.POString | string <repeatable>
The strings to concatenate to this one. If an array is passed as first parameter, its elements will be concatenated, while non-first parameters are ignored.
Returns:
A new string containing the result of the concatenation
- Type
- olympe.df.POString
-
concatenate(otherOString [, separator])
-
Concatenate this string with another using an optional separator and return the result as a new OString.
Parameters:
Name Type Argument Default Description otherOStringolympe.df.POString | string The string to concatenate to this one
separatorolympe.df.POString | string <optional>
'' the string to insert between the 2 strings
Returns:
A new string containing the result of the concatenation
- Type
- olympe.df.POString
-
contains(otherOString)
-
Checks whether this
OStringcontains another string.Parameters:
Name Type Description otherOStringolympe.df.POString | string The string to be searched for in this string.
Returns:
trueif thisOStringcontainsotherOString- Type
- olympe.df.POBoolean
-
endsWith(otherString [, position])
-
Checks whether this String ends with a specified substring.
Parameters:
Name Type Argument Default Description otherStringolympe.df.POString | string the string to be searched for at the end of this string
positionolympe.df.PONumber | number <optional>
-1 The position in
string at which to begin searching forotherString`Returns:
trueif the specified string matches the end of this string- Type
- olympe.df.POBoolean
-
equals( [otherOString])
-
Checks whether the value of this
OStringis equal to another string.Parameters:
Name Type Argument Description otherOStringolympe.df.OString | string <optional>
the string or
OStringto compare withReturns:
trueif both strings are equal, false otherwise- Type
- boolean
-
getLength()
-
Gets the length of this
OString.Returns:
- Type
- olympe.df.PONumber
-
indexOf(otherString [, startPos])
-
Returns the index of (the position of) the first occurrence of a specified text in a string. For startPos values lower than 0 or greater than the length of the string, the search starts at index 0 and the end of the string respectively.
Parameters:
Name Type Argument Default Description otherStringolympe.df.POString | string The string to search
startPosolympe.df.PONumber | number <optional>
0 The position where to start the search
Returns:
the position of the searched string, -1 if not found
- Type
- olympe.df.PONumber
-
isEmpty()
-
Checks whether this
OStringis empty or not.Returns:
trueif this string is empty.- Type
- olympe.df.OBoolean
-
lastIndexOf(otherString [, startPos])
-
Returns the index of (the position of) the last occurrence of a specified text in a string. If startPos is greater than the length of the string, the whole string is searched. If startPos is smaller than 0, the behavior will be the same as if it would be 0.
Parameters:
Name Type Argument Default Description otherStringolympe.df.POString | string The string to search
startPosolympe.df.PONumber | number <optional>
Infinity The index of the last character in the string to be considered as the beginning of a match
Returns:
the position of the searched string, -1 if not found
- Type
- olympe.df.PONumber
-
oEquals( [otherOString])
-
Checks whether this
OStringis equal to another string.Parameters:
Name Type Argument Description otherOStringolympe.df.POString | string <optional>
the string or
OStringto compare withReturns:
true if both strings are equal, false otherwise
- Type
- olympe.df.POBoolean
-
padEnd(length, padString)
-
Pad the current string with another string (multiple times, if needed) until the resulting string reaches the specified length. The padding is applied from the current string end.
Parameters:
Name Type Description lengtholympe.df.PONumber padStringolympe.df.POString Returns:
- Type
- olympe.df.POString
-
padStart(length, padString)
-
Pad the current string with another string (multiple times, if needed) until the resulting string reaches the specified length. The padding is applied from the current string start.
Parameters:
Name Type Description lengtholympe.df.PONumber padStringolympe.df.POString Returns:
- Type
- olympe.df.POString
-
replace(pattern, replacement)
-
Return a new string in which the first match of
patternhas been replaced byreplacement. Bothpatternandreplacementare strings.Parameters:
Name Type Description patternolympe.df.POString replacementolympe.df.POString Returns:
- Type
- olympe.df.POString
-
slice(startPos [, endPos])
-
Extracts a section of a string and returns it as a new string. If a parameter is negative, the position is counted from the end of the string. If no end position is provided, extracts to the end of the string.
Parameters:
Name Type Argument Description startPosolympe.df.PONumber | number starting position
endPosolympe.df.PONumber | number <optional>
end position, the character at this index will not be included.
Returns:
A new string containing the extracted section of the string.
- Type
- olympe.df.POString
-
startsWith(otherString [, position])
-
Checks whether this String starts with a specified substring.
Parameters:
Name Type Argument Default Description otherStringolympe.df.POString | string the string to be searched for at the start of this string
positionolympe.df.PONumber | number <optional>
0 The position in
stringat which to begin searching forotherStringReturns:
trueif the specified string matches the start of this string- Type
- olympe.df.POBoolean
-
subOStr(start, length)
-
Returns a new string that is a substring of this string. The substring begins at the specified
startand that is up tolengthlong.Examples:
new OString("hamburger").subOStr(4, 4) returns "urge" new OString("smiles").subOStr(1, 6) returns "miles"Parameters:
Name Type Description startolympe.df.PONumber | number lengtholympe.df.PONumber | number Returns:
- Type
- olympe.df.POString
-
threshold(threshold)
-
Returns the full string if it is longer or equal to the threshold, otherwise return an empty string.
Parameters:
Name Type Description thresholdolympe.df.PONumber | number After which the string is returned
Returns:
- Type
- olympe.df.POString
-
toJSON()
-
Converts this
OStringinto a JSON string.Returns:
- Type
- string
-
toLowerCase()
-
Converts this
OStringinto all lower cases and returns the result in a new instance.Returns:
the lowercase conversion of this
OString- Type
- olympe.df.POString
-
toONumber()
-
Converts this
OStringinto a number.Returns:
the converted value
- Type
- olympe.df.PONumber
-
toONumberInt(radix)
-
Converts this string into an integer number.
Parameters:
Name Type Description radixnumber - See:
-
olympe.df.ONumber#toONumber
Returns:
the converted value.
- Type
- olympe.df.PONumber
-
toOString()
-
Converts this Object into an
OString.Returns:
this
OString- Type
- olympe.df.POString
-
toString()
-
Gets the string value of this
OString.- Deprecated:
-
- Use
valueOfinstead
- Use
Returns:
String representation of this OString
- Type
- string
-
toUpperCase()
-
Converts this
OStringinto all upper cases and returns the result in a new instance.Returns:
the uppercase conversion of this
OString- Type
- olympe.df.POString
-
trim()
-
Removes whitespace from both ends of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (LF, CR, etc.).
Returns:
A new string representing the calling string stripped of whitespace from both ends.
- Type
- olympe.df.POString
-
valueOf()
-
Returns the value of this
OString.Returns:
This OString as a primitive string
- Type
- string
Olympe SDK