יחידה:String: הבדלים בין גרסאות בדף

קפיצה לניווט קפיצה לחיפוש
נוספו 637 בתים ,  12 בספטמבר 2024
מ
החזרת פונקציונליות קודמת
מ (גרסה אחת יובאה: ייבוא תבניות ראשוני מחב"דפדיה. קרדיט לויקיפדיה על מה שהועתק מהם לחב"דפדיה)
ויקיטקסט>Fuzzy
מ (החזרת פונקציונליות קודמת)
שורה 486: שורה 486:
for i,v in pairs(frame.args) do
for i,v in pairs(frame.args) do
if i>1 then
if i>1 then
local m=mw.ustring.find( frame.args[1], v, 0, true)
local m=mw.ustring.find( frame.args[1], v, 0, false)
if m then
if m then
    return v
    return v
שורה 540: שורה 540:
str.encode = function(frame)
str.encode = function(frame)
return mw.text.encode( frame.args[1] or "" )
return mw.text.encode( frame.args[1] or "" )
end
str.urldecode = function( frame )
    local source = frame.args[1] or '';
    source = string.gsub(source, '%%(%x%x)',
        function (hex) return string.char(tonumber(hex,16)) end
    )
    return source
end
end


str["קידוד"] = str.encode
str["קידוד"] = str.encode
str['מיצוי מספר'] = function(frame)
local s = frame.args[1]
local def = frame.args[2] or ''
if not s then return def end
local int, frac = s:match('[^%d.-]*(%-?[%d,]*)(%.%d+)')
if int or frac then
int = string.gsub(int or '', ',', '') -- remove commas
frac = frac or ''
return int .. frac
end
int = s:match('[^%d.-]*(%-?[%d,]*)')
int = int and string.gsub(int or '', ',', '')
return int or def
end


return str
return str
משתמש אלמוני

תפריט ניווט