۵ آبان ۱۳۸۹, ۰۲:۵۱ عصر
ضمن سلام
مثال :
موفق باشيد
تابع زير به جهت حذف يك كاراكتر خاص از داخل يك رشته ميتواند مورد استفاده قرار بگيرد .
کد:
Public Function StripChars(EnteryText As String, StripChar As String) As String
On Error GoTo StripCharsError
Dim lngFound As Long
lngFound = 1
Do Until lngFound = 0
lngFound = InStr(EnteryText, StripChar)
If lngFound = 0 Then GoTo AllDone
EnteryText = Left(EnteryText, lngFound - 1) & Mid(EnteryText, lngFound + 1)
Loop
AllDone:
StripChars = EnteryText
StripCharsExit:
Exit Function
StripCharsError:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume StripCharsExit
End Function
مثال :
کد:
StripChars("Sample---Text","-")=SampleText
StripChars("Sample Text"," ")=SampleText