scripting@wanadoo.nl




Replace()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
18 April 2002 Replace()
AuthorMichel Sijmons, original by Jeff Shahan.
Action The function replace all subString in a String with another subString.
SyntaxReplace (SourceString, ChrToReplace, ReplacementChr) 
Parameters
  • SourceString (Required / String) The text in which you want to replace some characters.
  • ChrToReplace (Required / String) The string you want to replace.
  • ReplacementChr (Required / String) The string you want to replace with. 
  • RemarksThe function is case unaware. 
    ReturnsA String with all subStrings change to a new subString. 
    DependenciesNone. 
    Examples
    Dim $NewString
    $OldString = "There#Once#Was#A#Man"
    
    ? $OldString
    $NewString = Replace($OldString ,"#","\")
    ? $NewString        ; the string is now "There\Once\Was\A\Man"
    $NewString = Replace($NewString ,"a","?")
    ? $NewString        ; the string is now "There\Once\W?s\?\M?n"
    
     
    Source
    FUNCTION Replace ($sourcestring, $chrtoreplace, $replacementchr)
      $array=Split($sourcestring,$chrtoreplace,-1)
      FOR EACH $element IN $array
          $replace=$replace+$element+$replacementchr
      NEXT
      $replace=Substr($replace,1,Len($replace)-1)
    ENDFUNCTION ; - Replace -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter