Difference between revisions of "Module:StringHelpers"
Jump to navigation
Jump to search
(Created page with "local p = {} function p.getParagraphFromQuestion(param) string = param.args[1] return string.find(s, '-', 1, true) end return p") |
(No difference)
|
Revision as of 12:48, 12 April 2020
Module supports numbers with max 3 digits.
Tests
Simple question
Expected | Actual |
---|---|
150 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
15 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
150 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
15 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
Complex question
Expected | Actual |
---|---|
6 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
10 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
99 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
101 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
6 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
10 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
99 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
101 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
local p = {}
function p.getParagraphFromQuestion(param)
string = param.args[1]
return string.find(s, '-', 1, true)
end
return p