lua-users home
lua-l archive

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




Le ven. 21 juil. 2023, 15:32, Roberto Ierusalimschy <roberto@inf.puc-rio.br> a écrit :
For instance,

  string.gsub("1111", "11", ".")    -->  "1..1"

would be correct if there were no specified order.
This cannot be correct, each substitution replaces 2 characters by 1, so if you find two dots, you made 2 replacements, reducing thé length by 2, and the result must be ".."

However you could eventually get "1.1" with one replacement starting in the middle