Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Find/replace


'vbTextCompare or vbBinaryCompare for case sensitivity as needed
'StartPos and vbTextCompare are optional

'find (starting at the left)
i = Instr(StartPos, StringBeingSearched, SearchBeingSearchedFor, vbTextCompare)

'find (starting at the right)
i = InstrRev(StartPos, StringBeingSearched, StringBeingSearchedFor, vbTextCompare)

'replace
temp = Replace(StringBeingSearched, StringBeingSearchedFor, StartPos, vbTextCompare)