Copy Helpers - jbosh/calculator GitHub Wiki

What the heck are copy helpers?

Copy helpers will process anything you paste into the calculator from your clipboard.
So for example if you want to replace every word "duck" with the word "goose" you can do it.
The way these are run is top to bottom, if any of the helpers successfully modify the input, when the last helper is performed, the list will be started over again.

bool anythingChanged = true;
while(anythingChanged)
{
  anythingChanged = false;
  foreach(helper)
  {
    if(helper.ProcessString(input))
      anythingChanged = true
  }
}

Some useful helpers

Name Pattern Replacement Input Output
Vector 3 {[xX]=([^ ]+) [yY]=([^ ]+) [zZ]=([^ ]+) ?} {$1; $2; $3} {x=2 y=3 z=2} {2;3;2}
Simd Vec4 {([^ ]+), ([^ ]+), ([^ ]+), ([^ }]+)} {$1; $2; $3; $4} {2, 3, 4, 5} {2; 3; 4; 5}

The Editor

Input - Some sample input to quickly test your new helper.
Pattern - The regular expression you want to search for.
Replacement - What you want to be replaced. Groups are $1, $2, $n.
Result - Example result to make sure you did it right.

Input x=7, y=2
Pattern x=(\d+), y=(\d+)
Replacement $1, $2
Result 7, 2
⚠️ **GitHub.com Fallback** ⚠️