|
|
-
ฟังก์ชั่นเกี่ยวกับตัวอักษร
- Function UT_Token$(p_gSource$, p_gSeparator$)
- '-------------------------------------------------------
- 'Call: p_gSource$ String to modify
- ' p_gSeparator$ Delimiting string
- '
- 'Ret : UT_Token$ First token from string
- ' p_gSource$ Source with first token removed
- '
- 'Notes:
- '------------------------------------------------------
- Dim gToken$, iPos%
-
- iPos = InStr(p_gSource, p_gSeparator)
- If iPos = 0 Then
- gToken = p_gSource
- p_gSource = ""
- Else
- gToken = Left$(p_gSource, iPos - 1)
- p_gSource = Mid$(p_gSource, iPos + Len(p_gSeparator))
- End If
-
- UT_Token = gToken
- End Function
-
- Function UT_stuff$(p_tString$, p_iStart%, p_nDelete%, p_tStuff$)
- '----------------------------------------------
- '
- ' Call: p_tString string to stuff
- ' p_iStart starting position at which to stuff
- ' p_nDelete number of characters to delete
- ' p_tStuff text to stuff
- '
- ' Ret: string with requested deletion/db_valion
- ' eg. ?UT_stuff$("bcdefg", 2, 3, "x")
- ' bxfg
- '
- '----------------------------------------------
- UT_stuff = Left$(p_tString, p_iStart - 1) & p_tStuff & Mid$(p_tString, p_iStart + p_nDelete)
-
- End Function
-
- Function UT_StripCharacter(StringToStrip As String, StrippingChar As String) As String
- '------------------------------------------
- 'Call: StringToStrip
- ' StrippingChar
- ' eg. ? UT_StripCharacter("asdfasdfasdfasdf","a")
- ' "sdfsdfsdfsdf"
- '---------------------------------------
- Dim iCount As Integer
- Dim strTemp As String
-
- iCount = 1
- strTemp = StringToStrip
-
- Do While iCount <> 0
- 'Find the position of the character to be stripped
- iCount = InStr(iCount, strTemp, StrippingChar)
- 'If the character was found, then strip it
- If iCount <> 0 Then _
- strTemp = Left(strTemp, iCount - 1) & Right(strTemp, Len(strTemp) - iCount)
- Loop
-
- UT_ StripCharacter = strTemp
-
- End Function
|
|