Difference between revisions of "Category talk:StripToNumbers/testcases"

From blackwiki
Jump to navigation Jump to search
blackwiki>SMcCandlish
(test)
blackwiki>SMcCandlish
(test)
Line 1: Line 1:
 
==Strip units from CSS values (why I want this)==
 
==Strip units from CSS values (why I want this)==
 
* Input: -12em, 34px, 56.7%, 8.9;, 0
 
* Input: -12em, 34px, 56.7%, 8.9;, 0
* Result: {{#invoke:StripToNumbers | main | -12em, 34px, 56%, "78.9x0" }}
+
* Result: {{#invoke:StripToNumbers | main | -12em, 34px, 56.7%, 8.9;, 0 }}
 
* Input: inherit
 
* Input: inherit
 
* Result: {{#invoke:StripToNumbers | main | inherit }}
 
* Result: {{#invoke:StripToNumbers | main | inherit }}
Line 8: Line 8:
 
* Input: SDks]df9s>dfjklasdfk9kasdfkasdkie0kmc'@(aks
 
* Input: SDks]df9s>dfjklasdfk9kasdfkasdkie0kmc'@(aks
 
* Result: {{#invoke:StripToNumbers | main | SDks]df9s>dfjklasdfk9kasdfkasdkie0kmc'@(aks}}
 
* Result: {{#invoke:StripToNumbers | main | SDks]df9s>dfjklasdfk9kasdfkasdkie0kmc'@(aks}}
 +
* Input: "12.3x4"
 +
* Result: {{#invoke:StripToNumbers | main | "12.3x4" }}
  
 
==Halve number found in stuff==
 
==Halve number found in stuff==

Revision as of 08:23, 18 July 2015

Strip units from CSS values (why I want this)

  • Input: -12em, 34px, 56.7%, 8.9;, 0
  • Result: -12
  • Input: inherit
  • Result: Lua error in Module:StripToNumbers at line 8: Input did not contain valid numeric data.

Find numbers in a bunch of stuff

  • Input: SDks]df9s>dfjklasdfk9kasdfkasdkie0kmc'@(aks
  • Result: 9
  • Input: "12.3x4"
  • Result: 12.3

Halve number found in stuff

  • Input: foobarbaz50%blahblahblah
  • Result: 25
  • Input: -66.6666666666666666666666666666
  • Result: -33.333333333333
  • Input: chickenbutt
  • Result: Lua error in Module:StripToNumbers at line 8: Input did not contain valid numeric data.