Class
caplin.core

StringUtility

Utility class that provides methods for string manipulation.

Constructor Summary

Attributes Name and Description
caplin.core.StringUtility()

This is a static class that never needs to be instantiated.

Method Summary

Attributes Name and Description
<static> String buildString(Object source, String separator, boolean includeName)

Concatenates the string fields of an object into a single string, each field being separated from the next by 'separator'.

<static> Boolean isNullUndefinedOrEmpty(String source, Boolean trim)

Determines if the string is null, undefined or an empty string.

<static> Array splitAndTrim(String source, String separator)

Splits up the specified input string, based on the specified separator, and {@link #trim trims} each of the output strings.

Constructor Detail

caplin.core.StringUtility()

This is a static class that never needs to be instantiated.

Method Detail

<static> String buildString(Object source, String separator, boolean includeName)

Concatenates the string fields of an object into a single string, each field being separated from the next by 'separator'. If includeName is set to true, then the field name will also be included in the string.

Parameters
Object source The object whose fields will be concatenated into a single string.
String separator The string to use as the separator between each field in the returned string.
boolean includeName If true, the names of the object's fields will be included in the returned string.
Returns
{String} A single string representing all the string fields of an object.

<static> Boolean isNullUndefinedOrEmpty(String source, Boolean trim)

Determines if the string is null, undefined or an empty string.

Parameters
String source The string to be tested
Boolean trim (Optional) Defaults to false. If true any whitespace will be trimmed before performing the empty string comparison.

<static> Array splitAndTrim(String source, String separator)

Splits up the specified input string, based on the specified separator, and {@link #trim trims} each of the output strings. For example, the string "one, two, three" split with a comma separator will produce an array output of ["one","two","three"].

Parameters
String source The string to be split up.
String separator The separator which will be used to split the string up.
Returns
{Array} An array containing the split string, with each of the contents of the array trimmed.