org.terrier.utility
Class StringTools

java.lang.Object
  extended by org.terrier.utility.StringTools

public class StringTools
extends java.lang.Object

This class implements useful string functions


Nested Class Summary
static class StringTools.ESCAPE
          Defines escape encodings that are supported.
 
Constructor Summary
StringTools()
           
 
Method Summary
static java.lang.String escape(StringTools.ESCAPE e, java.lang.String s)
          Escape a String according to the defined escape sequence requested
static java.lang.String normaliseEncoding(java.lang.String encodingName)
          Normalises several common encodings found, for instance in HTTP or HTML headers, into the compatible Java encoding
static java.lang.String unescape(StringTools.ESCAPE e, java.lang.String s)
          Unescape a String according to the defined escape sequence requested
static int utf8_length(java.lang.String s)
          Returns how long String s is in bytes, if encoded in UTF-8
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTools

public StringTools()
Method Detail

escape

public static java.lang.String escape(StringTools.ESCAPE e,
                                      java.lang.String s)
Escape a String according to the defined escape sequence requested


unescape

public static java.lang.String unescape(StringTools.ESCAPE e,
                                        java.lang.String s)
Unescape a String according to the defined escape sequence requested


utf8_length

public static int utf8_length(java.lang.String s)
Returns how long String s is in bytes, if encoded in UTF-8

Parameters:
s - The string to be measured.
Returns:
The number of bytes s is when encoded in UTF-8

normaliseEncoding

public static java.lang.String normaliseEncoding(java.lang.String encodingName)
Normalises several common encodings found, for instance in HTTP or HTML headers, into the compatible Java encoding



Terrier 3.5. Copyright © 2004-2011 University of Glasgow