Difference between revisions of "Module:StringHelpers"
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
function p.getParagraphFromQuestion(param) | function p.getParagraphFromQuestion(param) | ||
| − | i, j = string.match(param.args[1], '-', 1, true) | + | i, j = string.match(param.args[1], '-', 1, true); |
| − | return i | + | return i; |
end | end | ||
return p | return p | ||
Revision as of 13:07, 12 April 2020
Module supports numbers with max 3 digits.
Tests
Simple question
| Expected | Actual |
|---|---|
| 150 | |
| 15 | |
| 7 | |
| 150 | |
| 15 | |
| 7 |
Complex question
| Expected | Actual |
|---|---|
| 6 | - |
| 7 | - |
| 10 | - |
| 99 | - |
| 101 | - |
| 6 | - |
| 7 | - |
| 10 | - |
| 99 | - |
| 101 | - |
local p = {}
function p.getParagraphFromQuestion(param)
i, j = string.match(param.args[1], '-', 1, true);
return i;
end
return p