יחידה:String: הבדלים בין גרסאות בדף
מ אילו מכיל |
מ str.contains_any_csv |
||
| שורה 493: | שורה 493: | ||
end | end | ||
--[[ | |||
contains_any_csv | |||
This function returns the first matched element or empty string. | |||
Usage: | |||
{{#invoke:String|contains_any_csv|string|search1,search2,search3}} | |||
Parameters | |||
1: string | |||
2: comma seperated list of strings to search within the first string | |||
]] | |||
function str.contains_any_csv( frame ) | |||
for word in mw.ustring.gmatch(frame.args[1], '([^,]+)') do | |||
local m=mw.ustring.find( frame.args[1], word, 0, true) | |||
if m then | |||
return word | |||
end | |||
end | |||
return | |||
end | |||
return str | return str | ||