thaicosmic.com

หนัง

วันเสาร์ที่ 30 มกราคม พ.ศ. 2553

Code สำหรับตัด-เพิ่มจุดออกจากข้อมูล

ตัดจุด
Function TrimText(SourceText As String) As String
Dim i As Integer
TrimText = ""
For i = 1 To Len(SourceText)
If Mid(SourceText, i, 1) <> "." Then
TrimText = TrimText & Mid(SourceText, i, 1)
End If
Next i
End Function

เพิ่มจุด (ตำแหน่งที่ 3 จากซ้าย)
Function AddDot(SourceText As String) As String
If Len([SourceText]) <= 3 Then
AddDot = SourceText
Else
AddDot = Left([SourceText], 3) & "." & Right([SourceText], Len([SourceText]) - 3)
End If
End Function