Module:PageNameManipulate

local p = {}

function p.RemoveFromRight(frame) Right = frame.args[1] ThisPageTitle = mw.title.getCurrentTitle PageName = ThisPageTitle.text Result = string.sub(PageName, 1, Right) return Result end

function p.RemoveFromLeft(frame) Left = frame.args[1] ThisPageTitle = mw.title.getCurrentTitle PageName = ThisPageTitle.text Result = string.sub(PageName, Left, #PageName) return Result end

function p.RemoveFromBoth(frame) Left = frame.args[1] Right = frame.args[2] ThisPageTitle = mw.title.getCurrentTitle PageName = ThisPageTitle.text Result = string.sub(PageName,Left,Right) return Result end

function p.FirstWord(frame) ThisPageTitle = mw.title.getCurrentTitle PageName = ThisPageTitle.text Right = string.find(PageName," ")-1 Result = string.sub(PageName,1,Right)

return Result end

function p.WhatsBetween(frame) FirstPart = frame.args[1] SecondPart = frame.args[2] ThisPageTitle = mw.title.getCurrentTitle PageName = ThisPageTitle.text FirstPartWhere = string.find(PageName,FirstPart) FirstPartLength = string.len(FirstPart) Start = FirstPartWhere + FirstPartLength SecondPartWhere = string.find(PageName,SecondPart,FirstPartWhere)

Result = string.sub(PageName,Start,SecondPartWhere-1) return Result

end return p