If iterating the string an test with IsDigit
and IsLetter
a bit to complexe,
You can use Regex for this : (?<Alfas>[a-zA-Z]+)|(?<Digits>\d+)|(?<Others>[^a-zA-Z\d])
1/. Named Capture Group Alfas (?<Alfas>[a-zA-Z]+)
Match a single character present in the list below [a-zA-Z]+
a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)
+
Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
2/. Named Capture Group Digits (?<Digits>[\d,.]+)
\d+ matches a digit (equal to [0-9])
+
Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
3/. Named Capture Group Others (?<Others>[^a-zA-Z\d]+)
Match a single character not present in the list below [^a-zA-Z\d]
a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)
\d matches a digit (equal to [0-9])
+
Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
Then to get one goup values:
var matches = Regex.Matches(testInput, pattern).Cast<Match>();
var alfas = matches.Where(x => !string.IsNullOrEmpty(x.Groups["Alfas"].Value))
.Select(x=> x.Value)
.ToList();
LiveDemo