lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

The answer to this is probably embarrassingly simple!
 
Iterating over a string where each element is delimited by a single character is simple enough, e.g.:

s = "a;b;c"             (where a, b and c can be any length)

for p in s:gmatch("([^;]+)") do 
   print(p) 
end

but what is the best way of doing the same thing for a string where the delimiter is ;;, e.g.

s = "a;;b;;c"             (where a, b and c can be any length and can include non repeating occurrences of ; )

Thanks

Mark