Advertisement
a3f

php str_replace equivalent

a3f
Mar 14th, 2012
1,151
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM Function does only replace first occurence unlike the php one
  2.  
  3. Function StrReplace$(search$, replace$, subject$)
  4. from = instr(subject$, search$)
  5.     if from = 0 then     
  6.         StrReplace$ = "0"
  7.     else
  8.         till = from + len(search$)
  9.         leng = len(subject$)
  10.         StrReplace$ = Left$(subject$,from - 1) + replace$ + Right$(subject$,(leng - till + 1))
  11.     end if
  12. End Function
Advertisement
RAW Paste Data Copied
Advertisement