com.atlassian.core.util
Class StringUtils

java.lang.Object
  extended bycom.atlassian.core.util.StringUtils

public class StringUtils
extends java.lang.Object


Field Summary
protected static java.util.Map stringCharMappings
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static boolean contains(java.lang.String value, java.util.List possiblyContains)
          Tests to see is a string contains any of the string in the list passed
static java.lang.String createCommaSeperatedString(java.util.Collection entries)
          Create a String of comma seperated entries from a Collection.
static java.lang.String crop(java.lang.String original, int cropAt, java.lang.String suffix)
          Crop a string if it is longer than a certain length, adding the specified suffix.
static boolean equalsIgnoreLineTerminators(java.lang.String s1, java.lang.String s2)
           
static java.lang.String escapeCP1252(java.lang.String s, java.lang.String encoding)
          replaces "smart quotes" and other problematic characters that appear in JIRA when data is cut and pasted from a Microsoft word document.
static boolean isStringAllASCII(java.lang.String str)
          Tests if all the characters in the string is an ASCII character
static boolean isStringISO_8859_1(java.lang.String string)
           
static boolean isStringOfCharSet(java.lang.String string, java.lang.String charset)
          Checks if all the characters in the string are from the specified character set
static java.lang.String normalise(java.lang.String value)
           
static java.lang.String replaceAll(java.lang.String str, java.lang.String oldPattern, java.lang.String newPattern)
          Replaces all occurrences of one string with another.
static java.lang.String[] splitCommaSeparatedString(java.lang.String entryString)
          Method will turn a String of comma seperated entities into a String Array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stringCharMappings

protected static java.util.Map stringCharMappings
Constructor Detail

StringUtils

public StringUtils()
Method Detail

escapeCP1252

public static final java.lang.String escapeCP1252(java.lang.String s,
                                                  java.lang.String encoding)
replaces "smart quotes" and other problematic characters that appear in JIRA when data is cut and pasted from a Microsoft word document.

These include smart single and double quotes, ellipses, em-dashes and bullets (these characters belong to the Windows Code Page 1252 encoding)

Parameters:
s - string to simplify
encoding - eg. UTF-8, Big5, ISO-8859-1 etc.
Returns:

crop

public static java.lang.String crop(java.lang.String original,
                                    int cropAt,
                                    java.lang.String suffix)
Crop a string if it is longer than a certain length, adding the specified suffix.

If the string is shorter than the cropAt length, then it is returned unchanged.


contains

public static boolean contains(java.lang.String value,
                               java.util.List possiblyContains)
Tests to see is a string contains any of the string in the list passed


replaceAll

public static java.lang.String replaceAll(java.lang.String str,
                                          java.lang.String oldPattern,
                                          java.lang.String newPattern)
Replaces all occurrences of one string with another.


isStringAllASCII

public static boolean isStringAllASCII(java.lang.String str)
Tests if all the characters in the string is an ASCII character


isStringOfCharSet

public static boolean isStringOfCharSet(java.lang.String string,
                                        java.lang.String charset)
Checks if all the characters in the string are from the specified character set


isStringISO_8859_1

public static boolean isStringISO_8859_1(java.lang.String string)

equalsIgnoreLineTerminators

public static boolean equalsIgnoreLineTerminators(java.lang.String s1,
                                                  java.lang.String s2)

normalise

public static java.lang.String normalise(java.lang.String value)

splitCommaSeparatedString

public static java.lang.String[] splitCommaSeparatedString(java.lang.String entryString)
Method will turn a String of comma seperated entities into a String Array. Spaces before or after the comma will be cropped.

Parameters:
entryString - A comma seperated String
Returns:
String Array

createCommaSeperatedString

public static java.lang.String createCommaSeperatedString(java.util.Collection entries)
Create a String of comma seperated entries from a Collection.

Parameters:
entries - A collection of entries
Returns:
Comma seperated String


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.