com.atlassian.core.util
Class StringUtils

java.lang.Object
  extended by com.atlassian.core.util.StringUtils

public class StringUtils
extends Object


Field Summary
protected static Map<String,char[][]> stringCharMappings
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static boolean contains(String value, List<String> possiblyContains)
          Tests to see is a string contains any of the string in the list passed
static String createCommaSeperatedString(Iterable<String> entries)
          Create a String of comma seperated entries from a Collection.
static String crop(String original, int cropAt, String suffix)
          Crop a string if it is longer than a certain length, adding the specified suffix.
static boolean equalsIgnoreLineTerminators(String s1, String s2)
           
static String escapeCP1252(String s, 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(String str)
          Tests if all the characters in the string is an ASCII character
static boolean isStringISO_8859_1(String string)
           
static boolean isStringOfCharSet(String string, String charset)
          Checks if all the characters in the string are from the specified character set
static String normalise(String value)
           
static String replaceAll(String str, String oldPattern, String newPattern)
          Replaces all occurrences of one string with another.
static String[] splitCommaSeparatedString(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 Map<String,char[][]> stringCharMappings
Constructor Detail

StringUtils

public StringUtils()
Method Detail

escapeCP1252

public static final String escapeCP1252(String s,
                                        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 String crop(String original,
                          int cropAt,
                          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(String value,
                               List<String> possiblyContains)
Tests to see is a string contains any of the string in the list passed


replaceAll

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


isStringAllASCII

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


isStringOfCharSet

public static boolean isStringOfCharSet(String string,
                                        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(String string)

equalsIgnoreLineTerminators

public static boolean equalsIgnoreLineTerminators(String s1,
                                                  String s2)

normalise

public static String normalise(String value)

splitCommaSeparatedString

public static String[] splitCommaSeparatedString(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 String createCommaSeperatedString(Iterable<String> entries)
Create a String of comma seperated entries from a Collection.

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


Copyright © 2015 Atlassian. All rights reserved.