dk.brics.string
Class Misc

java.lang.Object
  extended by dk.brics.string.Misc

public class Misc
extends Object

Convenience methods.


Method Summary
static String escape(String s)
          Escapes special characters in a string.
static String formatExample(String example)
          Formats a string so it can be printed out friendly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

escape

public static String escape(String s)
Escapes special characters in a string.


formatExample

public static String formatExample(String example)
Formats a string so it can be printed out friendly. In particular, the empty string "" will be replaced by "<empty string>" (without the quotes) to make it more readable. If null is passed to the method, the string "<empty language>" is returned, to mimic the result of Automaton.getShortestExample(boolean) on an empty-languaged automaton.

Parameters:
example - an example string from an automaton
Returns:
a non-null string of length at least one, without "strange" characters


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.