- 将名称字段解析为“姓氏”、名字、中间名。如果有第二个名称,则第二个名称需要在其自己的字段中。并非所有名字都有第二个名字。
- 如果名称是企业,我需要在姓氏字段中填写全名,在名字和中间名中填写空白。
我的代码:
Const ForReading = 1
x=0
on error resume next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("Test.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
arrName = Split(strLine, vbTab)
msgbox(arrName(x))
x = x+1
Loop
文件如下所示
Name 2nd name
ABDELMAGID A SMITH & LISA S
ABDELMAGID A SMITH & LISA S
CLEVELAND SANDY LEE
CLEVELAND SANDY LEE
WHALEN STEPHEN H & JOAN L
WHALEN STEPHEN H & JOAN L
BANK TWO OF VIRGINIA INC C/O DOE JOHN
BANK TWO OF VIRGINIA INC C/O DOE JOHN
BANK TWO OF VIRGINIA INC C/O DOE JOHN
SMITH JOHN ELLIS JR
JONES JOHN III