Sha1395
asked on
Split the string based on Decimal point
Hi,
I have ths code,i want to split the string based on decimal point
Eg: Jack.Smith
i want to split the sting and get only smith
my code
String = " Jack.Smith"
if (username.Contains("."))
{
// username = username.Replace(".", " ");
string updateuser=username.Substr ing(0,user name.Index Of("."));
Console.WriteLine(updateus er);
}
I have ths code,i want to split the string based on decimal point
Eg: Jack.Smith
i want to split the sting and get only smith
my code
String = " Jack.Smith"
if (username.Contains("."))
{
// username = username.Replace(".", " ");
string updateuser=username.Substr
Console.WriteLine(updateus
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi
Please try the following code.
Thanks
Sri Narayana Rao.D
Please try the following code.
string str = "Jack.Smith";
if (str.Contains('.'))
{
// When we do split on the string, it will internally store as a string arry. to print all the values
// i am doing the foreach loop
foreach (var item in str.Split('.'))
{
Console.WriteLine(item.ToString());
}
}
Let me know your feed back..Thanks
Sri Narayana Rao.D
Open in new window
I hope this helps.