Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module talk:Sandbox/Matroc/Str swap

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia

Testing String Swap

[edit]
  • 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: Some Old Things are like New
    • 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: Some Newer Things are like Old

NOTE NOTE NOTE

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