View Single Post
Old 19th January 2006, 14:35   #204  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Not necessary better but a different approach:

Code:
public int ExtractDelay(string value) {
    Match m = Regex.Match(value, @"(-?\d+)ms\.");
    if (m.Success) return int.Parse(m.Groups[1].Value);
    return 0;
}
stax76 is offline