|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.twitterapime.util.StringUtil
public final class StringUtil
This class provides some useful methods to work with strings.
| Method Summary | |
|---|---|
static long |
convertTweetDateToLong(java.lang.String date)
Convert a given date according to a format used by Twitter to long. |
static java.lang.String |
encode(java.lang.String s,
java.lang.String enc)
Encode a given string. |
static java.lang.String |
formatTweetID(java.lang.String id)
Format the Tweet ID returned by Twitter Search API. |
static boolean |
isEmpty(java.lang.String str)
Verify whether the given string is null or empty. |
static java.lang.String |
removeTags(java.lang.String str)
Remove any tag occurrence from the given string. |
static java.lang.String[] |
split(java.lang.String str,
char delimiter)
Split a string based on a given delimiter. |
static java.lang.String[] |
splitTweetAuthorNames(java.lang.String name)
Split the author's username and name from the given string, according to the format: " |
static java.lang.String |
zeroPad(int n,
int len)
Return a padded string with leading zeros. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static long convertTweetDateToLong(java.lang.String date)
Convert a given date according to a format used by Twitter to long.
Formats:
date - Tweet date value.
java.lang.IllegalArgumentException - If date is null/empty.
public static final java.lang.String[] split(java.lang.String str,
char delimiter)
Split a string based on a given delimiter.
str - String.delimiter - Delimiter.
java.lang.IllegalArgumentException - If str is null.public static java.lang.String formatTweetID(java.lang.String id)
Format the Tweet ID returned by Twitter Search API.
id - Tweet ID.
java.lang.IllegalArgumentException - If ID is null.public static java.lang.String removeTags(java.lang.String str)
Remove any tag occurrence from the given string.
str - String to be parsed.
java.lang.IllegalArgumentException - If str is null.public static java.lang.String[] splitTweetAuthorNames(java.lang.String name)
Split the author's username and name from the given string, according to
the format: "
name - The name.
java.lang.IllegalArgumentException - If str is null.
public static java.lang.String zeroPad(int n,
int len)
Return a padded string with leading zeros.
n - Number.len - String length.
public static java.lang.String encode(java.lang.String s,
java.lang.String enc)
Encode a given string. If encode type is not informed, UTF-8 is considered.
s - String to encode.enc - Encode.
java.lang.IllegalArgumentException - If string is empty or null.public static final boolean isEmpty(java.lang.String str)
Verify whether the given string is null or empty.
str - The string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||