Remove Middle Initial from Name Value of String Before Importing value to Database Table
Posted on 2008-06-18
I am attempting to write code in a VBScript that will find and replace a pattern of
space middle initial space
in a name value and replace it with a space only .
The value is coming from a text file that is being opened as an FSO and fields are defined through the use of the split function of each line in the file using Split(sLine, ",") The name field is one of the sections parsed in a line within this comma delimited text file.
I do not want to remove any additional names in the field. Some of the values in the name field have 2 last names that are not hypenated - I need to keep this the same. Again, the pattern to be replaced should only be a single alpha character between two spaces.
For example, John S Doe to be John Doe.
John S Doe Smith will be changed to John Doe Smith.
I want the final format of the Name value to be updated before it gets inserted into a table.