Модуль:String: различия между версиями

Содержимое удалено Содержимое добавлено
+ функция сравнения двух UTF-8 строк
+ str.rep
Строка 428:
local str2 = frame.args[2] or '';
return str._strcmp(str1 , str2)
end
 
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'функция rep ожидает число во втором параметре, а получено "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end