Click or drag to resize
ZenophSMSextractPhoneNumbers Method (String, ListString)
Searches and extracts phone numbers from specified System.String input source.

Namespace: Zenoph.SMSLib
Assembly: Zenoph.SMSLib (in Zenoph.SMSLib.dll) Version: 2015.9.30.0 (2015.09.30.0)
Syntax
public List<string> extractPhoneNumbers(
	string source,
	out List<string> rejected
)

Parameters

source
Type: SystemString
The source from where phone numbers should be searched and extracted.
rejected
Type: System.Collections.GenericListString
Holds a list of rejected phone numbers either because they are invalid or not allowed on user routes.

Return Value

Type: ListString
Returns valid phone numbers found in the specified source.
Examples
// example source containing phone numbers
string str = "Mr. ABC, XYZ Street, Kumasi, Tel: 233240111111;  Mr. EFG, AY Avenue, Kumasi, Tel: 0208999999;";

// The following method call will return the phone numbers 233240111111, 233208999999 into
// the variable nums, assuming that the default dial code is +233 (for 0208999999 to 233208999999)
// It also returns rejected destinations in the second argument.
List<string> rejected = null;     // will hold rejected destinations, if any
List<string> nums = ZenophSMS.extractPhoneNumbers(str, out rejected);

// add the phone numbers.
foreach (string phonenum in nums)
    sms.addRecipient(phonenum, true);  // ignore throwing of Exception when the phone number is invalid.

From the above code, phone numbers that were rejected are saved in the rejected variable. This facility is the only difference between this method and extractPhoneNumbers(String).

See Also