me.grison.jtoml
Class Util.TomlString

java.lang.Object
  extended by me.grison.jtoml.Util.TomlString
Enclosing class:
Util

public static class Util.TomlString
extends Object

Toml String Utilities.

Note: This is to avoid dependency on Apache commons for such limited features.


Constructor Summary
Util.TomlString()
           
 
Method Summary
static int countOccurrences(String str, String needle)
          Counts the number of occurrences of a String in an other String.
static String escape(String input)
          Escapes a list of literals found in the given String.
static String unescape(String input)
          Unescape a list of literals found in the given String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util.TomlString

public Util.TomlString()
Method Detail

unescape

public static String unescape(String input)
Unescape a list of literals found in the given String. It will replace characters ('\' + 't', '\' + 'n', ...) to there equivalent ('\t', '\n').

Parameters:
input - the String to unescape
Returns:
the unescaped String

escape

public static String escape(String input)
Escapes a list of literals found in the given String. It will replace characters ('\t', '\n', ...) to there equivalent ('\' + 't', '\' + 'n').

Parameters:
input - the String to escape
Returns:
the escaped String

countOccurrences

public static int countOccurrences(String str,
                                   String needle)
Counts the number of occurrences of a String in an other String.

Parameters:
str - the String to search in.
needle - the String to count the occurrences of.
Returns:
the number of occurrences found.


Copyright © 2013. All Rights Reserved.