Replace



[1]
strX.sRep( str , {newStr} {,max} ) / strX.iRep( str {,newStr} {, max} ) replace
  Returns newStr
  str String to search for
  newStr String to replace oldStr  with. Default is <empty>
  max Optional maximum replacements to be made. Default = 0, for all appearances.
     
  Description Replaces up to max appearances of str in strX. The result will be a new string, of type and CP equal to strX's
sRep: case sensitive.
iRep: case insensitive.
     
  Examples put _s("abcd-ABCD").sRep("a")  -- remove all instances of "a", case sensitive.
-- bcd-ABCD
put _s("abcd-ABCD").iRep("a")  -- remove all instances of "a".
-- bcd-BCD
put _s("abcd-ABCD").iRep("a", "*") -- replace "a", with "*"
-- *bcd-*BCD
put _s("abcd-ABCD").iRep("a", "*", 1) -- replace the first instance of "a", with "*"
-- *bcd-ABCD
     
  Notes  

[2]
strX.sRepSel( strBgn , strEnd, {newStr}) / strX.iRepSel( strBgn, strEnd, {,newStr}) replace selection
  Returns newStr
  strBgn Beginning of string to search for
  strEnd End of string to search for
  newStr String to replace selection with. Default is <empty>
     
  Description Replaces all substrings of strX starting with strBgn and ending with strEnd with the new string newStr
sRepSel: case sensitive.
iRepSel: case insensitive.
     
  Examples put _s("abcd ab123cd").iRepSel("b", "c", "*")
-- a*d a*d
     
  Notes  

[3]
strX.sMergeSeqOf( str) / strX.iMergeSeqOf( str ) replace sequence of substrings with substring
  Returns newStr
  str Target substring
     
  Description Replaces a sequence of substrings (e.g. "bb") with a single substring ("b")
     
  Examples put _s("aA , bB").iMergeSeqOf("b")
-- aA , b
put _s("- abcABC -").iMergeSeqOf("abc")
-- - abc -
     
  Notes  

[4]
strX.sStripLinesOf({str}) remove lines containing only specific characters
  Returns newStr
  str String containing target characters. Default = white space characters
     
  Description Removes all lines containing only the type of characters of str. If str is not specified, the default value of 'white spaces' will be used, filtering out all blank lines.
     
  Examples put _s("a"&return&return&"b").sStripLinesOf()
-- a
b
put _s("a"&return&"cd"&return&"b").sStripLinesOf("dc")
-- a
b
     
  Notes