org.apache.cocoon.util
Class StringUtils

java.lang.Object
  extended by org.apache.cocoon.util.StringUtils

public class StringUtils
extends Object

A collection of String handling utility methods.

Version:
CVS $Id: StringUtils.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha, Stefano Mazzocchi

Constructor Summary
StringUtils()
           
 
Method Summary
static int count(String str, char c)
          Deprecated. Use StringUtils.countMatches(String, String)
static boolean isAlphaNumeric(char c)
          Tests whether a given character is alphabetic, numeric or underscore
static int matchStrings(String a, String b)
          Deprecated. Use StringUtils.indexOfDifference(String, String)
static String replaceToken(String s)
          Replaces tokens in input with Value present in System.getProperty
static String[] split(String line)
          Split a string as an array using whitespace as separator
static String[] split(String line, String delimiter)
          Split a string as an array using a given set of separators
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

split

public static String[] split(String line)
Split a string as an array using whitespace as separator

Parameters:
line - The string to be split
Returns:
An array of whitespace-separated tokens

split

public static String[] split(String line,
                             String delimiter)
Split a string as an array using a given set of separators

Parameters:
line - The string to be split
delimiter - A string containing token separators
Returns:
An array of token

isAlphaNumeric

public static boolean isAlphaNumeric(char c)
Tests whether a given character is alphabetic, numeric or underscore

Parameters:
c - The character to be tested
Returns:
whether the given character is alphameric or not

count

public static int count(String str,
                        char c)
Deprecated. Use StringUtils.countMatches(String, String)

Counts the occurrence of the given char in the string.

Parameters:
str - The string to be tested
c - the char to be counted
Returns:
the occurrence of the character in the string.

matchStrings

public static int matchStrings(String a,
                               String b)
Deprecated. Use StringUtils.indexOfDifference(String, String)

Matches two strings.

Parameters:
a - The first string
b - The second string
Returns:
the index where the two strings stop matching starting from 0

replaceToken

public static String replaceToken(String s)
Replaces tokens in input with Value present in System.getProperty



Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.