String

extends Node

A String node represents an immutable Unicode character sequence.

Constructors

String other, Node deep value = other.value; Node value this.value = value.stringValue();

Type Functions

boolean()

Get the Boolean value of this String.

See also: XPath v1.0 4.3 Boolean Functions

A string is true if and only if its length is non-zero

bytes()

Encode this String into a sequence of bytes.

Returns: A new Bytes object

charCodeAt(Node position)

Get the character code for the character at the given zero-indexed position. If this string does not have enough characters this function returns the empty set.

concat(Node other)

Create a new String that is the concatentation of this String and the string value of other.

contains(Node other)

Determine whether this String contains the character sequence represented by the string value of other.

endsWith(Node other)

Determine whether this String ends with the character sequence represented by the string value of other.

indexOf(Node other)

Get the first index of other.

Returns: The index of the first occurence of the string value of other if contained within this String (starting at 1), otherwise 0.

lastIndexOf(Node other)

Get the last index of other.

Returns: The index of the last occurence of the string value of other if contained within this String (starting at 1), otherwise 0.

length()

Get the size of this string

Returns: The number of characters in this String

lower()

Get this character sequence turned into lower case.

match(Node pattern)

Returns a nodeset containing a String for each match in this String of the regular expression pattern.

Same as: RegularExpression($pattern).match($this)

match(Node pattern, Node limit)

Returns a nodeset containing a String for each match in this String of the regular expression pattern, stopping after limit splits.

Same as: RegularExpression($pattern).match($this, $limit)

matches(Node pattern)

Returns: Boolean true if this string matches pattern at least once.

Same as: RegularExpression($pattern).matches($this)

number()

See also: XPath v1.0 4.4 Number Functions

A string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is the nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN.

split(Node pattern, Node limit)

Returns a nodeset containing the substring before and after each match in this String of the regular expression pattern, stopping after limit splits.

Same as: RegularExpression($pattern).split($this, $limit)

split(Node pattern)

Returns a nodeset containing the substring before and after each match in this String of the regular expression pattern.

Same as: RegularExpression($pattern).split($this)

startsWith(Node other)

Determine whether this String starts with the character sequence represented by the string value of other.

string()

Get the string value of this String.

substitute(Node pattern, Node substitution, Node limit)

Creates a new String where every match of the regular expression pattern has been replaced by the substitution expression substitution, stopping after limit substitutions.

Same as: RegularExpression($pattern).substitute($this, $substitution, $limit)

substitute(Node pattern, Node substitution)

Creates a new String where every match of the regular expression pattern has been replaced by the substitution expression substitution.

Same as: RegularExpression($pattern).substitute($this, $replacement)

substring(Node from)

Create a new String that is the character sequence that starts at position from of this String and continues to the end of the sequence.

Same as: substring($this, $from)

substring(Node from, Node to)

Create a new String that is the character sequence that starts at and includes position from of this String and continues to position to, noninclusive.

Same as: substring($this, $from, $to)

substringAfter(Node other)

Create a new String that is the character sequence that starts after the first position in this String of the string value of other and continues to the end.

Returns: A new String containing the sequence after the first match, or an empty String if this String does not contain other

substringAfterLast(Node other)

Create a new String that is the character sequence that starts after the last position in this String of the string value of other and continues to the end.

Returns: A new String containing the sequence after the last match, or an empty String if this String does not contain other

substringBefore(Node other)

Get the character sequence that starts at the beginning of this String and continues to the first position of the string value of other.

Returns: A new String containing the sequence before the first match, or an empty String if this String does not contain other

substringBeforeLast(Node other)

Create a new String that is the character sequence that starts at the beginning of this String and continues to the last position of the string value of other.

Returns: A new String containing the sequence before the last match, or an empty String if this String does not contain other

translate(Node from, Node to)

Same as: translate($this, $from, $to)

trim()

Creates a new String by removing any leading or trailing whitespace from this String.

upper()

Get this character sequence turned into upper case.

Functions inherited from Node