vb string parsing help needed
Posted on 2011-09-23
I have a file of names that I need to parse out into a shorter version of the name as I write them to a new file. In each record, the string psOrig contains the company name, and it might be one, two, or three words or more, with spaces in between each word. For example, psOrig might contain 'Sony', or 'Sony Electronics', or 'Sony Electronics Corporation', etc. I need a way to put only the first two words into psNew, meaning that if psOrig contains 'Sony Electonics', or 'Sony Electronics Corporation', all that would end up in psNew would be 'Sony Electronics'. And, if psOrig only contains one word, then that's what I would want in psNew.
I need help with coding this, with a routine that can detect the spaces and parse this out properly for each name.....TIA