String Manipulation (C#)

  • Thread starter Thread starter Aaron
  • Start date Start date
A

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
}

Thanks
 
Hi Aaron,

Have a look at the String.Split methode, does it almost automaticly for you
(You have to delete the first "\" and the last "/" after using it)

I hope this helps,

Cor
 
Back
Top