Hi Everyone,
I was wondering if someone could help me, or point me in the right direction. I have a string that looks like "S123456.002". I want to manipulate this string to where I get 2 different strings off this one. For instance, I want "S123456" as one string and "002" as another. But I also want to strip off the zeros on the "002" and get just "2". So pretty much I want to separate the string at the "." and create 2 strings from the separation. I am not sure where to start. Any help would be greatly appreciated. Thanks in advance.
Jay
JayPosted Nov 3, 2008, 11:30 AM
Worked perfect Alan. Thanks for your help.
Jay
AlanPosted Nov 3, 2008, 11:03 AM
Here's some code to do that:
using System;
class Program
{
static void Main()
{
string s = "S123456.002";
string[] items = s.Split('.');
items[1] = items[1].TrimStart('0');
foreach(string item in items)
{
Console.WriteLine(item);
}
Console.ReadLine();
}
}