public class ContactUtils extends Object
| Constructor and Description |
|---|
ContactUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> List<List<T>> |
chopped(List<T> list,
int length)
Method to break a
List into multiple smaller lists. |
static String |
getAllButLastContacts(String recipients)
This method is used to get only the fully entered contacts from a string.
|
static List<String> |
getContactsAsList(String recipients)
This method is used to convert a String version of a list of contacts to an array of formatted numbers that can be used
for sending an SMS.
|
static String |
getLastContact(String recipients)
This method returns the text that follows the last contact separator in the string.
|
static boolean |
hasMultipleContacts(String recipients)
This method determines if there is more than one contact entered in a String.
|
static boolean |
isNumber(String number)
Method to check if a String is a valid phone number.
|
static String |
removeIrishPrefix(String recipient)
This method is used to replace the Irish +353 prefix with a 0.
|
static List<String> |
removeIrishPrefixFromRecipients(List<String> recipients)
This method is used to replace the Irish +353 prefix with a 0.
|
static String |
trimSeparators(String recipients)
This method is used to remove unneeded contact separator characters from a String.
|
public static <T> List<List<T>> chopped(List<T> list, int length)
List into multiple smaller lists.public static boolean hasMultipleContacts(String recipients)
recipients - A string containing one or more contacts.true if there is more than one contact, otherwise false.public static String getAllButLastContacts(String recipients)
recipients - A string containing one or more contacts.public static String getLastContact(String recipients)
recipients - The string to search.public static List<String> getContactsAsList(String recipients)
recipients - A string containing one or more contacts.public static String trimSeparators(String recipients)
recipients - A string containing one or more contacts.public static String removeIrishPrefix(String recipient)
recipient - A phone number to remove the Irish prefix from.public static List<String> removeIrishPrefixFromRecipients(List<String> recipients)
recipients - Recipient List to remove Irish prefix from, '+353' to '0'.public static boolean isNumber(String number)
A valid phone number contains only numbers and can optionally start with a +.
number - The String to be tested.true if the String is a valid phone number, otherwise false.Copyright © 2015. All rights reserved.