co.cask.common
Class StringUtils

java.lang.Object
  extended by co.cask.common.StringUtils

public class StringUtils
extends Object

Utility for strings.


Nested Class Summary
static class StringUtils.TraditionalBinaryPrefix
          The traditional binary prefixes, kilo, mega, ..., exa, which can be represented by a 64-bit integer.
 
Field Summary
static String[] EMPTY_STRING_ARRAY
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static String arrayToString(String[] strs)
          Given an array of strings, return a comma-separated list of its elements.
static Collection<String> getStringCollection(String str)
          Returns a collection of strings.
static String[] getStrings(String str)
          Returns an arraylist of strings.
static Collection<String> getTrimmedStringCollection(String str)
          Splits a comma separated value String, trimming leading and trailing whitespace on each value.
static String[] getTrimmedStrings(String str)
          Splits a comma separated value String, trimming leading and trailing whitespace on each value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING_ARRAY

public static final String[] EMPTY_STRING_ARRAY
Constructor Detail

StringUtils

public StringUtils()
Method Detail

getStrings

public static String[] getStrings(String str)
Returns an arraylist of strings.

Parameters:
str - the comma seperated string values
Returns:
the arraylist of the comma seperated string values

getStringCollection

public static Collection<String> getStringCollection(String str)
Returns a collection of strings.

Parameters:
str - comma seperated string values
Returns:
an ArrayList of string values

getTrimmedStringCollection

public static Collection<String> getTrimmedStringCollection(String str)
Splits a comma separated value String, trimming leading and trailing whitespace on each value.

Parameters:
str - a comma separated with values
Returns:
a Collection of String values

getTrimmedStrings

public static String[] getTrimmedStrings(String str)
Splits a comma separated value String, trimming leading and trailing whitespace on each value.

Parameters:
str - a comma separated with values
Returns:
an array of String values

arrayToString

public static String arrayToString(String[] strs)
Given an array of strings, return a comma-separated list of its elements.

Parameters:
strs - Array of strings
Returns:
Empty string if strs.length is 0, comma separated list of strings otherwise


Copyright © 2015 Cask Data, Inc. Licensed under the Apache License, Version 2.0.