Salam
di. ini gua punya functionnya.
coba dimodifikasi dikit, agar karakter yang akan digantikan maupun
karakter penggantinya dijadikan parameter dari fungsi tersebut.
... gampanglah, mas ardi pasti bisa.??
'--------------------------------------------------------------'
'---> Function string yang digunakan untuk merubah karaker <---'
' dalam satu kalimat, yang terkadang bikin crash program '
'--------------------------------------------------------------'
Public Function SrchReplace(ByVal sStringToFix As String) As String
Dim iPosition As Integer 'where is the offending char? '
Dim sCharToReplace As String 'which char do we want to replace? '
Dim sReplaceWith As String 'what should it be replaced with? '
Dim sTempString As String 'build the correct returned string '
Dim strAwal As String
Dim ada As Boolean
ada = False
strAwal = sStringToFix
sCharToReplace = "!" '<<--- karakter yang akan diganti adalah tanda petik
sReplaceWith = " " '<< ini adalah karakter penggantinya (space)
iPosition = InStr(sStringToFix, sCharToReplace)
Do While iPosition
sTempString = ""
sTempString = sTempString & Left$(sStringToFix, iPosition - 1)
sTempString = sTempString & sReplaceWith
sTempString = sTempString & _
Mid$(sStringToFix, iPosition + 1, Len(sStringToFix))
sStringToFix = sTempString
iPosition = InStr(iPosition + 2, sStringToFix, sCharToReplace)
ada = True
Loop
If ada = True Then
SrchReplace = sTempString
Else
SrchReplace = strAwal
End If
End Function
contoh:
dim namaOk as string
namaOK = SrchReplace("asep!")
msgbox namaOK
jangan takut takut untuk memakai function dalam hal text searching, karena
komputer sekarang sudah canggih dan cepat dalam memprosesnya.
semoga bisa membantu
salam
basmal
> Selamat pagi.....
>
>
> Dears.....Saya pemula nih.......mau minta tolong boleh ya..........
>
> Saya punya tabel yang berisi daftar nama-nama yang kadang-kadang ada yang
> mengandung special character seperti @, !......, saya mau menghilangkan
> special charackter tersebut bagaimana caranya ya ?
> misalnya : asep! menjadi asep, [EMAIL PROTECTED] menjadi Jaka.
>
> Thanks...ya
>
>
>
>
>
> The contents of this e-mail and attachments are confidential and subject
> to legal privilege. If you are not the intended recipient, you are
> strictly prohibited and may be unlawful to use, copy, store, distribute,
> disclose or communicate any part of it to others and you are obliged to
> return it immediately to sender or notify us and delete the e-mail and any
> attachments from your system. PT BANK PERMATA TBK and subsidiaries do not
> accept liability for loss or damage resulting from computer viruses. The
> integrity of e-mail across the internet cannot be guaranteed and PT BANK
> PERMATA TBK will not accept liability for any claims arising as a result
> of the use of this medium for transmissions by or to PT BANK PERMATA TBK.
>
>
~~~~~~~oooOOOooo~~~~~~~
Universitas Bunda Mulia
IT Department
04022002-271900
Basmal