S
SamIAm
How do I extract the last 3 characters of a string i.e.
string s = "000001" I want "001"
Thanks,
S
string s = "000001" I want "001"
Thanks,
S
SamIAm said:How do I extract the last 3 characters of a string i.e.
string s = "000001" I want "001"
How do I extract the last 3 characters of a string i.e.
string s = "000001" I want "001"
Jeff Green said:string temp = "";
string s = "000001";
for (int i = s.Length - 3; i < s.Length ; i++)
{
temp += s; // the three characters you're looking for
// are now in the string 'temp';
}
How do I extract the last 3 characters of a string i.e.
string s = "000001" I want "001"
Hope that helps...Jeff
- --
Jeff Green
Greentrees - All pigs fed and ready to fly
(e-mail address removed)
Jeff Green said:string temp = "";
string s = "000001";
for (int i = s.Length - 3; i < s.Length ; i++)
{
temp += s; // the three characters you're looking for
// are now in the string 'temp';
}