clark.xpath
Class StringFunctions

java.lang.Object
  |
  +--clark.xpath.StringFunctions

public class StringFunctions
extends java.lang.Object

This is a function library which contains functions concerning string processing.


Constructor Summary
StringFunctions()
           
 
Method Summary
static java.lang.String concat(java.lang.String[] a)
          Concatinates the two Strings passed as arguments.
static java.lang.Boolean contains(java.lang.String a, java.lang.String b)
          Returns true if the first String contains the second one.
static java.lang.String getString(clark.xpath.AtomicObject o)
          Returns the string representation of its argument.
static java.lang.String getString(w3c.dom.Node context)
          Returns the string representation of the context node.
static java.lang.String getStringValue(w3c.dom.Node node)
          Converts a Node from the DOM tree to string, depending on its type.
static java.lang.String normalize_space(w3c.dom.Node context)
           
static java.lang.String normalize_space(java.lang.String s)
          Normalizes the white spaces in the string argument, i.e. when in the string there are subsequent occurances of spaces, Tabs, NLs, and CRs, they are substituted by one space.
static java.lang.Boolean starts_with(java.lang.String a, java.lang.String b)
          Returns true if the second string is the first part of the first one.
static java.lang.Double string_length(w3c.dom.Node context)
          Returns the length of the String representation of the context node.
static java.lang.Double string_length(java.lang.String s)
          Returns the length of the String passed as an argument.
static java.lang.String substring_after(java.lang.String a, java.lang.String b)
          Returns a substring of the first string starting from the end of the first occurance of the second string to the end.
static java.lang.String substring_before(java.lang.String a, java.lang.String b)
          Returns a substring of the first string starting from the begining to the first occurance of the second string.
static java.lang.String substring(java.lang.String s, java.lang.Double start)
          Returns a substring of the first string, starting from the argument index to the end of the string.
static java.lang.String substring(java.lang.String s, java.lang.Double start, java.lang.Double len)
          Returns a substring of the first string, starting from the argument index with a length len.
static java.lang.String translate(java.lang.String a, java.lang.String b, java.lang.String c)
          Substitutes all occurances in the first string of letters from the second string with letters from the third one, which are situated at the position of the old letter in the second string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringFunctions

public StringFunctions()
Method Detail

getString

public static java.lang.String getString(w3c.dom.Node context)
                                  throws ParseException
Returns the string representation of the context node.

ParseException

getString

public static java.lang.String getString(clark.xpath.AtomicObject o)
Returns the string representation of its argument. There are several rules in the XPath specification for converting different types of objects to string.


getStringValue

public static java.lang.String getStringValue(w3c.dom.Node node)
Converts a Node from the DOM tree to string, depending on its type.


concat

public static java.lang.String concat(java.lang.String[] a)
Concatinates the two Strings passed as arguments.


starts_with

public static java.lang.Boolean starts_with(java.lang.String a,
                                            java.lang.String b)
Returns true if the second string is the first part of the first one.


contains

public static java.lang.Boolean contains(java.lang.String a,
                                         java.lang.String b)
Returns true if the first String contains the second one.


substring_before

public static java.lang.String substring_before(java.lang.String a,
                                                java.lang.String b)
Returns a substring of the first string starting from the begining to the first occurance of the second string. If the first string does not contain the second, then an empty string is returned.


substring_after

public static java.lang.String substring_after(java.lang.String a,
                                               java.lang.String b)
Returns a substring of the first string starting from the end of the first occurance of the second string to the end. If the first string does not contain the second, then an empty string is returned.


substring

public static java.lang.String substring(java.lang.String s,
                                         java.lang.Double start)
Returns a substring of the first string, starting from the argument index to the end of the string.


substring

public static java.lang.String substring(java.lang.String s,
                                         java.lang.Double start,
                                         java.lang.Double len)
Returns a substring of the first string, starting from the argument index with a length len.


string_length

public static java.lang.Double string_length(java.lang.String s)
Returns the length of the String passed as an argument.


string_length

public static java.lang.Double string_length(w3c.dom.Node context)
                                      throws ParseException
Returns the length of the String representation of the context node.

ParseException

normalize_space

public static java.lang.String normalize_space(w3c.dom.Node context)

normalize_space

public static java.lang.String normalize_space(java.lang.String s)
Normalizes the white spaces in the string argument, i.e. when in the string there are subsequent occurances of spaces, Tabs, NLs, and CRs, they are substituted by one space.


translate

public static java.lang.String translate(java.lang.String a,
                                         java.lang.String b,
                                         java.lang.String c)
Substitutes all occurances in the first string of letters from the second string with letters from the third one, which are situated at the position of the old letter in the second string. Example: translate("abcdef","acf","xyz") -> result "xbydez"