How to split a string index with character and digits using C#?


Hi there,

I´m trying to write a component that starts by reading a text file composed of many lines. The first few are composed by a bunch of characters, white spaces and numbers or digits.

I need to know the way that extracts the numbers or digits that are located after an undefined number of white spaces.

Thank you in advance

(Nathan 'jesterKing' Letwory) #2

Call the .Trim() method on your string before splitting your string to get bunch of numbers as strings.

Or you can use the appropriate classes from the System.Text.RegularExpressions namespace.

Documentation to learn from:

(David Rutten) #3

In addition to Nathan’s advice, might be helpful if you upload a sample of the data you’re parsing.