you can use this Split overload with StringSplitOptions.RemoveEmptyEntries
. It will:
Splits a string into substrings based on the strings in an array.
in this case split the string by spaces. Now you need to take just the first element:
string input = @" UWORD /* data */ ";
string value = input.Split(new string[] {" "}, StringSplitOptions.RemoveEmptyEntries).First();
EDIT: this looks like you are scanning code and retrieve datatype names. In this case you might have not only spaces but also tabs. If this is the case just include also tabs into the string array that holds the delimiters:
string value = input.Split(new string[] {" ", "\t"}, StringSplitOptions.RemoveEmptyEntries).First();
Apparently it is also possible to catch all whitespace characters. Here is the trick to do that:
string value = input.Split(new char[0], StringSplitOptions.RemoveEmptyEntries).First();