Package org.jaxen.function
Class StringLengthFunction
java.lang.Object
org.jaxen.function.StringLengthFunction
- All Implemented Interfaces:
Function
4.2 number string-length(string)
The string-length function returns the number of Unicode characters
in its argument. This is not necessarily
the same as the number Java chars
in the corresponding Java string. In particular, if the Java String
contains surrogate pairs each such pair will be counted as only one character
by this function. If the argument is omitted,
it returns the length of the string-value of the context node.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StringLengthFunction
public StringLengthFunction()Create a newStringLengthFunction
object.
-
-
Method Details
-
call
Returns the number of Unicode characters in the string-value of the argument.
- Specified by:
call
in interfaceFunction
- Parameters:
context
- the context at the point in the expression when the function is calledargs
- a list containing the item whose string-value is to be counted. If empty, the length of the context node's string-value is returned.- Returns:
- a
Double
giving the number of Unicode characters - Throws:
FunctionCallException
- if args has more than one item
-