Hi Aaron,
I would like to randomly output phone numbers seperated by \ and / from a
string. s = "\231-3423/\453-1234/\231-3473/\231-3474/"
//c sharp code
private string GetPhoneNum()
{
s = "\231-3423/\453-1234/\231-3473/\231-3474/"
//randomly pick a phone num from string.
n = randomNum;
return n;//ie. 453-1234
}
Try to use the regular expressions:
Regex re = new Regex(@"\([0-9]{3}-[0-9]{4})/", RegexOptions.Multiline);
MatchCollection m = re.Matches(s);
return m[n].Group[1].Value; // n = 0..count-1, where count is a total number
of phone numbers.
--
______________________________
With best wishes, Arthur Nesterovsky
Visit, please, my home page:
http://www.nesterovsky-bros.com