Module:Strip to numbers/testcases

From Wikipedia, the free encyclopedia

Page Module:Message box/ombox.css has no content.

Strip units from CSS values (why I want this)

  • Input: -12em, 34px, 56.7%, "89", 0
  • Result: Script error: No such module "StripToNumbers".
  • Input (will choke because of multiple . characters: -12em, 34px, 56.7%, "8.9", 0
  • Result: Script error: No such module "StripToNumbers".
  • Input (will choke because of multiple - characters: -12em, 34px, 57%, "-8.9", 0
  • Result: Script error: No such module "StripToNumbers".
  • Input: inherit
  • Result: Script error: No such module "StripToNumbers".

Find numbers in a bunch of stuff

  • Input: SDks]df9s>dfjklasdfk9kasdfkasdkie0kmc'@(aks
  • Result: Script error: No such module "StripToNumbers".
  • Input: "12.3x4"
  • Result: Script error: No such module "StripToNumbers".

Halve number found in stuff

  • Input: foobarbaz50%blahblahblah
  • Result: Script error: No such module "StripToNumbers".
  • Input: -66.6666666666666666666666666666
  • Result: Script error: No such module "StripToNumbers".
  • Input: chickenbutt
  • Result: Script error: No such module "StripToNumbers".

Nastier input tests

  • Input: style="font-size: 70% ;"
  • Result: Script error: No such module "StripToNumbers".
  • Input: 'style="font-size: 70% ;"'
  • Result: Script error: No such module "StripToNumbers".
  • Input: `style="font-size: 70% ;"`
  • Result: Script error: No such module "StripToNumbers".
  • Input: =70%
  • Result: Script error: No such module "StripToNumbers".

Yeah, it dies on contact with =. Can it be escaped? (see below: use |1=)

  • Input: {{=}}70%
  • Result: Script error: No such module "StripToNumbers".
  • Input: style{{=}}"font-size: 70% ;"
  • Result: Script error: No such module "StripToNumbers".
  • Input: <span style{{=}}"font-size: 70%;">
  • Result: Script error: No such module "StripToNumbers".
  • Input: <span style<nowiki>=</nowiki>"font-size: 70%;">
  • Result: Script error: No such module "StripToNumbers".

Yes, though only with Template:Tlx; it chokes on <nowiki>...</nowiki>. Though this points out the relative uselessness of trying to use this on strings this complicated, since -70 is the opposite of the desired output, 70. It needs to be able to discern with - is directly associated with a numeral (or perhaps a ., since while -.7 is crappy style, it's still a technically valid way to write -0.7.

Try: |1=

  • Input: 1=70%
  • Result: Script error: No such module "StripToNumbers". Green tickY


  • Input: <span class="nowrap"><span data-sort-value="7001123000000000000♠"></span>12.3</span> (produced by {{val|12.3}})
  • Result: Script error: No such module "StripToNumbers".

After upgrade to match more narrowly

  • Input: style{{=}}"margin-left: 10% ;"
  • Result: Script error: No such module "StripToNumbers".
  • Input: style{{=}}"margin-left: -10% ;"
  • Result: Script error: No such module "StripToNumbers".
  • Input: Weasels - 12. Chickens - 72.
  • Result: Script error: No such module "StripToNumbers".