Module talk:Sandbox/Matroc/Str swap

= Testing String Swap =

  • Module test to swap 2 pieces data in a string
  • Can act as a replacement when the swap with argument is not contained in a string
  • Swap Old with New: Some New Things are like Old -
     {{#invoke:Sandbox/Matroc/Str swap|swapreplace|Some New Things are like Old|New|Old|1}} 
  • Output: {{#invoke:Sandbox/Matroc/Str swap|swapreplace|Some New Things are like Old|New|Old|1}}
  • Swap New with Newer: Some New Things are like Old -
     {{#invoke:Sandbox/Matroc/Str swap|swapreplace|Some New Things are like Old|New|Newer|1}} 
  • Output: {{#invoke:Sandbox/Matroc/Str swap|swapreplace|Some New Things are like Old|New|Newer|1}}

= NOTE NOTE NOTE =

  1. This module might also be simplified or improved using a different strategy of capture and recover in gsub
  2. * example: str:gsub("(this)(.*)(that)","%3%2%1") or something like that. Needs to be looked at as there are many possibilities...