나는이 나는, 그것은 작동하지 않습니다 파일에서 추출한 값 중 하나에 트림 (STR)를 사용하지만 때마다, 쉼표로 구분 된 텍스트 파일에서 읽는 스크립트 ...VBScript를 트림 기능
내 텍스트 파일 :
some string, anotherstring, onelaststring
some string, anotherstring, onelaststring
some string, anotherstring, onelaststring
some string, anotherstring, onelaststring
내 스크립트 :
는Dim fso, myTxtFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set myTxtFile = fso.OpenTextFile("mytxt.txt")
Dim str, myTxtArr
txtContents myTxtFile.ReadAll
myTxtFile.close
myTxtArr = Split(txtContents, vbNewLine)
For each line in myTxtArr
tLine = Split(tLine, ",")
Trim(tLine(1))
If tLine(1) = "anotherstring" Then
MsgBox "match"
End If
Next
내 스크립트는 결코 "일치"를 도달하지 나는 이유를 모르겠어요.
배열 범위를 벗어나는 오류가 발생합니까? – STLDeveloper
오류가 없으며 그냥 자르지 않습니다 – tarki
'trim ("some strings, anotherstring, onelaststring")은 결코 ""anotherstring "과 동일하지 않습니다. 아마도 ","에 줄을 나누고 싶습니까? –