Module:PeopleName
Jump to navigation
Jump to search
Lua
CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules
This module is intended for processing of strings containing people's names
Code
--[[
This module is intended for processing of strings containing people's names
]]
local name = {}
--[[
]]
function name.Eastern2Western_order( frame )
local s = frame.args[1] or ''
if s~='' then
s = mw.text.trim(s)
local n = string.len( s )
local k = string.find( s, ',') -- find first comma
local m = string.find( s, ' ') -- find first space
if k and m and m>k then
s = mw.text.trim(string.sub( s, k+1, n)) .. ' ' .. mw.text.trim(string.sub( s, 1, k-1 ))
end
end
return s
end
return name