Hi, split the problem in a couple of smaller ones. There are at least two parts: 1. locate the "word" that contains the number 2. translate that word to a numeric value 1. depends on what you do know about the pattern in the string. e.g. if the number is always at the end, find the last space, get the substring behind it. if there is exactly one word plus a space in front, find that first space and look for a possible space after the number too. 2. is easy with int.Parse or int.TryParse If you were really lazy (I wouldn't dare to assume that), split the entire string in words based on a space, then foreach "word" do a TryParse until one succeeds. And now you are on your own I guess. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets