Class Misc

  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


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


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.

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

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