SMILA 1.0 API documentation

org.eclipse.smila.utils.string
Class StringTypesUtils

java.lang.Object
  extended by org.eclipse.smila.utils.string.StringTypesUtils

public final class StringTypesUtils
extends java.lang.Object

Utility Class bundling common/useful methods for different string types (StringBuider, String, Charsequence, ...). Might get split up into several classes when becoming too big.

Author:
tmenzel

Method Summary
static void assertWhitespaceFree(java.lang.CharSequence value, java.lang.String valueDescription)
           
static void assertWhitespaceFree(java.lang.CharSequence value, java.lang.String formatString, java.lang.Object... formatObjects)
          Assert that given string is free of whitespaces as determined by Character.isWhitespace(char).
static char lastChar(java.lang.StringBuilder sb)
           
static void replaceEnd(java.lang.StringBuilder sb, int reverseOffsetFromEnd, java.lang.CharSequence string)
          Used to replace the end of the current buffer, starting at reverseOffsetFromEnd.
static java.lang.CharSequence right(java.lang.StringBuilder sb, int len)
          returns the CharSequence from the right but at most the whole buffer no matter how large len is.
static java.lang.StringBuilder setLengthRelative(java.lang.StringBuilder sb, int len)
          Add or subtract the len to the current length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setLengthRelative

public static java.lang.StringBuilder setLengthRelative(java.lang.StringBuilder sb,
                                                        int len)
Add or subtract the len to the current length.

Parameters:
sb - the sb
len - the length postive values will increase the buffer, negative will decrease. Latter case will not cause an exception if by this the length will be < 0 but will set it to 0.
Returns:
the string builder

right

public static java.lang.CharSequence right(java.lang.StringBuilder sb,
                                           int len)
returns the CharSequence from the right but at most the whole buffer no matter how large len is.

Parameters:
sb - the sb
len - the len
Returns:
the char sequence

lastChar

public static char lastChar(java.lang.StringBuilder sb)
Parameters:
mainQuery -
Returns:

replaceEnd

public static void replaceEnd(java.lang.StringBuilder sb,
                              int reverseOffsetFromEnd,
                              java.lang.CharSequence string)
Used to replace the end of the current buffer, starting at reverseOffsetFromEnd.

Parameters:
sb - the sb
reverseOffsetFromEnd - will be subtracted from length of sb, negative numbers will result in \0 being inserted. Must not be >1 sb.length
string - the string

assertWhitespaceFree

public static void assertWhitespaceFree(java.lang.CharSequence value,
                                        java.lang.String valueDescription)
Parameters:
valueDescription -
literalFilter -

assertWhitespaceFree

public static void assertWhitespaceFree(java.lang.CharSequence value,
                                        java.lang.String formatString,
                                        java.lang.Object... formatObjects)
Assert that given string is free of whitespaces as determined by Character.isWhitespace(char).

Parameters:
value - the value
formatString - the format string
formatObjects - the format objects

SMILA 1.0 API documentation