How can I get a part of a system's name? For instance if the computer name contains SERVER
then do something, and if it includes CLIENT
then do something else.
The names I an working with are similar to SERVER000455
. The numerical values change all the time but the SERVER
part is the same.
Getting the name is easy (SystemInformation.ComputerName
), but that wasn't my question. My question was getting just the first part of the name. The string[]
and split
doesn't seem to work since it's not an array. I just need to get the prefix of the PC name and drop the numerical bit.