vb6.0/vba [vb6.0/vba] 자막파일에서 텍스트 추출하기
페이지 정보
본문
Sub program1472()
Dim F As String
F = "C:\Users\kkkk7\Desktop\Sicko.2007.1080p.WEB-DL.DD5.1.H.264-TrollHD.smi"
F = ReadText(F)
F = Replace(F, " ", "")
Dim v As Variant, i As Integer
v = Split(F, "<")
For i = 1 To UBound(v)
If InStr(v(i), ">") Then v(i) = Split(v(i), ">")(1)
Next
F = Join(v)
SaveText "C:\Users\kkkk7\Desktop\tem.txt", F
End Sub
Public Function ReadText(Optional FilePath As String = "") As String
If Len(Dir$(FilePath)) = 0 Then Exit Function
Dim FN As Integer, tmp() As Byte
FN = FreeFile
ReDim tmp(FileLen(FilePath) - 1) As Byte
Open FilePath For Binary As #FN
Get #FN, , tmp
Close #FN
ReadText = StrConv(tmp, vbUnicode)
End Function
Public Function SaveText(ByVal FilePath As String, ByVal T As String) As Boolean
On Error GoTo TextERR2
Dim FN As Long
FN = FreeFile()
Open FilePath For Binary Access Write As #FN
Put #FN, , T
Close #FN
If Len(Dir$(FilePath)) Then SaveText = True
TextERR2:
End Function
- 이전글[vb6.0/vba] 생 년, 월, 일, 입력하고 주민번호 뒷 자리 입력받아 검증까지... 20.01.30
- 다음글[vb6.0/vba] 텍스트 문서(txt)로 저장하는 함수 20.01.15
댓글목록
등록된 댓글이 없습니다.