net.sourceforge.wurfl.core.utils
Class StringUtils

java.lang.Object
  extended by net.sourceforge.wurfl.core.utils.StringUtils

public final class StringUtils
extends Object

Strings matching utility class.

This class contains the utility methods for the strings.

Version:
$Id: StringUtils.java 432 2010-05-06 12:12:53Z filippo.deluca $
Author:
Fantayeneh Asres Gizaw, Filippo De Luca

Method Summary
static int firstSemiColon(String target)
           
static int firstSlash(String target)
          Return the position of first slash of the userAgent string.
static int firstSpace(String target)
          Return the position of first space of the given string.
static String hierarchyAsString(List hierarchy)
          Display a device hierarchy as String: generic -> ...
static int indexOf(String userAgent, String key)
           
static int indexOfOrLength(String target, String needle)
           
static int indexOfOrLength(String target, String needle, int startIndex)
           
static String ldMatch(SortedSet candidates, String needle, int tolerance)
          This method use the LDMatcher to search the given needle.
static int ordinalIndexOfOrLength(String target, String needle, int ordinal)
           
static int ordinalIndexOfOrLength(String target, String needle, int ordinal, int startIndex)
           
static String risMatch(SortedSet candidates, String needle, int tolerance)
          This method use the RISMatcher to search the given needle.
static int secondSlash(String target)
          Return the index of second of the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

firstSlash

public static int firstSlash(String target)
Return the position of first slash of the userAgent string.

Parameters:
target - A string to search first slash
Returns:
A index of first slash in the string or, if the string does not contain a slash, the string length

secondSlash

public static int secondSlash(String target)
Return the index of second of the given string.

Parameters:
target - A string on which find second slash.
Returns:
A index of second slash in the string.

firstSemiColon

public static int firstSemiColon(String target)

firstSpace

public static int firstSpace(String target)
Return the position of first space of the given string.

Parameters:
target - A string to search first slash
Returns:
A index of first space in the string or, if the string not containing a space, the whole string length

indexOfOrLength

public static int indexOfOrLength(String target,
                                  String needle)

indexOfOrLength

public static int indexOfOrLength(String target,
                                  String needle,
                                  int startIndex)

ordinalIndexOfOrLength

public static int ordinalIndexOfOrLength(String target,
                                         String needle,
                                         int ordinal)

ordinalIndexOfOrLength

public static int ordinalIndexOfOrLength(String target,
                                         String needle,
                                         int ordinal,
                                         int startIndex)

risMatch

public static String risMatch(SortedSet candidates,
                              String needle,
                              int tolerance)
This method use the RISMatcher to search the given needle.

Parameters:
needle - String to search
candidates - Strings to search against
tolerance - The tolerance to use in matching.
See Also:
RISMatcher.match(SortedSet, String, int)

ldMatch

public static String ldMatch(SortedSet candidates,
                             String needle,
                             int tolerance)
This method use the LDMatcher to search the given needle.

Parameters:
needle - String to search
candidates - Strings to search against
tolerance - The tolerance to use in matching.
See Also:
LDMatcher.match(SortedSet, String, int)

hierarchyAsString

public static String hierarchyAsString(List hierarchy)
Display a device hierarchy as String: generic -> ... -> root.

Parameters:
hierarchy - The hierarchy to convert.
Returns:
A string representing the given hierarchy.

indexOf

public static int indexOf(String userAgent,
                          String key)


Copyright © 2008-2010 WURFL-Pro srl. All Rights Reserved.