I'm looking for a good method of searching a string for a value, if the string was all numbers I would use a Convert.ToInt16() (or 32 depending on value) but this time the string in question is "2.08.08" if this is Converted with a ToInt() method it will error as the decimal is used twice.
The reason I can't use a substring() method to chop off the first is it is a version number so all the digits are important. I could use a foreach loop to remove the stops and then convert the string (2.08.08 would become 20808) and use it like that:
foreach (string subString in USB_Version.Split(Stop))
{
output += subString + ";";
count++;
if (count == 3)
{
Version_Number = subString;
break;
} Would this be good method or is there (as usual) a method I am not aware of??
Glenn

VulpesRank #55 · 29.2K reputationPosted Jul 17, 2012, 5:09 AM EDT
However, if you don't need the individual components, then you can simply use String.Replace to replace the dots with empty strings.
Glenn PattonRank #6,159 · 275 reputationPosted Jul 17, 2012, 5:38 AM EDT
(it's test code don't worry!)
The string.Replace method needs looking at thanks!
Glenn
Glenn PattonRank #6,159 · 275 reputationPosted Jul 17, 2012, 5:57 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jul 17, 2012, 6:08 AM EDT
Glenn PattonRank #6,159 · 275 reputationPosted Jul 18, 2012, 12:14 AM EDT
Glenn PattonRank #6,159 · 275 reputationPosted Jul 18, 2012, 12:14 AM EDT