EGF Engine
Release 0.1.0

org.eclipse.egf.common.helper
Class StringHelper

java.lang.Object
  extended by org.eclipse.egf.common.helper.StringHelper

public class StringHelper
extends Object

String helper.


Constructor Summary
StringHelper()
           
 
Method Summary
static String createHttpUri(String relativeUri_p)
          Create http prefixed uri from given one.
static String formatMessage(String message_p, Object[] arguments_p)
          Format given message with given arguments.
static String[] getTokens(String source_p, String separators_p)
          Get tokens from given source string using given separators.
static String replaceNonWordCharacters(String originalString_p, String replacementString_p)
          Replace non word characters with a replacement String
static String replaceNonWordCharactersWithDot(String originalString_p)
          Replace non word characters with dot characters
static String replaceNonWordCharactersWithUnderscore(String originalString_p)
          Replace non word characters with underscore characters
static String substring(String beginningDelimiter_p, String endingDelimiter_p, String content_p, boolean includeDelimiters_p)
          Returns a new string that is a substring of this string for specified parameters.
static String substringAfter(char separator_p, String source_p)
          Get the substring from given source string after given separator.
static String substringBefore(char separator_p, String source_p)
          Get the substring from given source string before given separator.
static String toLowerFirst(String source_p)
          Convert first character of given string to lower case.
static String toUpperFirst(String source_p)
          Convert first character of given string to upper case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringHelper

public StringHelper()
Method Detail

formatMessage

public static String formatMessage(String message_p,
                                   Object[] arguments_p)
Format given message with given arguments.
See MessageFormat for the acceptable form of the given message and the arguments.

Parameters:
message_p -
arguments_p -
Returns:

toLowerFirst

public static String toLowerFirst(String source_p)
Convert first character of given string to lower case.

Parameters:
source_p -
Returns:
new String with first character converted.

toUpperFirst

public static String toUpperFirst(String source_p)
Convert first character of given string to upper case.

Parameters:
source_p -
Returns:
new String with first character converted.

getTokens

public static String[] getTokens(String source_p,
                                 String separators_p)
Get tokens from given source string using given separators.

Parameters:
source_p -
separators_p - a string of separators to use while searching for tokens.
Returns:
null if source string is null, source string if no token could be found.
Otherwise return tokenized source string, separators excluded.

substringBefore

public static String substringBefore(char separator_p,
                                     String source_p)
Get the substring from given source string before given separator.

Parameters:
separator_p -
source_p -
Returns:
null if source string is null, source string itself if no substring could be found.
Otherwise return the substring from source string from the beginning to the separator position (separator excluded).

substringAfter

public static String substringAfter(char separator_p,
                                    String source_p)
Get the substring from given source string after given separator.

Parameters:
separator_p -
source_p -
Returns:
null if source string is null, source string itself if no substring could be found.
Otherwise return the substring from the separator position (separator excluded) to the end of source string.

createHttpUri

public static String createHttpUri(String relativeUri_p)
Create http prefixed uri from given one.

Parameters:
relativeUri_p -
Returns:

substring

public static String substring(String beginningDelimiter_p,
                               String endingDelimiter_p,
                               String content_p,
                               boolean includeDelimiters_p)
Returns a new string that is a substring of this string for specified parameters.
The substring begins at the index of beginningDelimiter_p and extends to the character at index of endingDelimiter_p.
Delimiters can be included in the returned substring depending on includeDelimiters_p value.

Parameters:
beginningDelimiter_p - the delimiter used as beginning delimiter.
endingDelimiter_p - the delimiter used as ending delimiter.
content_p - the source that the substring is extracted from.
includeDelimiters_p - true means the delimiters are included in the returned string.
Returns:
null if no substring found for given delimiters.

replaceNonWordCharactersWithDot

public static String replaceNonWordCharactersWithDot(String originalString_p)
Replace non word characters with dot characters

Parameters:
originalString_p -
Returns:
Each non-conforming character in given string is replaced by a dot character.

replaceNonWordCharactersWithUnderscore

public static String replaceNonWordCharactersWithUnderscore(String originalString_p)
Replace non word characters with underscore characters

Parameters:
originalString_p -
Returns:
Each non-conforming character in given string is replaced by an underscore character.

replaceNonWordCharacters

public static String replaceNonWordCharacters(String originalString_p,
                                              String replacementString_p)
Replace non word characters with a replacement String

Parameters:
originalString_p -
replacementString_p - each non word character is replaced by given string.
Returns:

EGF Engine
Release 0.1.0

Copyright (c) Thales Corporate Services S.A.S, 2009.

This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.