Simple Parse Question

  • Thread starter Thread starter Erik Lautier
  • Start date Start date
E

Erik Lautier

Hi, what's a quick way to parse a string and remove everything after
the comma including the comma? I.e., if the string is "Hi, how are
you", I would want to just keep "Hi".

Thanks!
 
Hi, what's a quick way to parse a string and remove everything after
the comma including the comma? I.e., if the string is "Hi, how are
you", I would want to just keep "Hi".


Probably something like

MyString.SubString(0, MyString.IndexOf(",") - 1)

If you need more complex parsing, take a look at Regular expressions.
 
That's great, thank you - got rid of the -1 at the end but other than
that it does the job.
 
Back
Top