Module:TildeToPipe
Jump to navigation
Jump to search
Module:TildeToPipe
Replaces all tilde (`~`) characters in a string with pipe (`|`) characters.
Usage
This module is primarily used when pipe characters cannot be written directly inside template parameters.
{{#invoke:TildeToPipe|main|Item 1~Item 2~Item 3}}
Output:
Item 1|Item 2|Item 3
Parameters
main
- 1
- A string containing tildes `~` to be replaced with pipes `|`.
local p = {}
function p.main(frame)
local input = frame.args[1]
if not input or input == '' then
return ''
end
-- replace all tildes with pipes
input = input:gsub("~", "|")
return input
end
return p