com.neoworks.util
Class StringEscaper

java.lang.Object
  |
  +--com.neoworks.util.StringEscaper

public class StringEscaper
extends java.lang.Object

Static methods for escaping strings

Version:
$Revision: 1.2 $
Author:
Nick Vincent nick@neoworks.com

Method Summary
static java.lang.String escape(java.lang.String str)
          Escape a string using predefined characters.
static java.lang.String escape(java.lang.String str, java.util.Map remapChars)
          Escape a string using a supplied remapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

escape

public static java.lang.String escape(java.lang.String str)
Escape a string using predefined characters. This will escape the following Characters Line Feed \n -> \\n\n Tab \t -> \\t\t Double Quote \" -> \\\" Carriage Return \r -> \\r\r

Parameters:
str - The string to escape
Returns:
The escaped string

escape

public static java.lang.String escape(java.lang.String str,
                                      java.util.Map remapChars)
Escape a string using a supplied remapping

Parameters:
str - the string to escapse
remapChars - A Map of Character to String object. These chars are remmaped.
Returns:
The escapsed string