Re: Use-cases for string.gsub(str, "().", "%1")
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Use-cases for string.gsub(str, "().", "%1")
- From: "Soni L." <fakedme@...>
- Date: 2015年8月20日 15:57:15 -0300
On 20/08/15 03:54 PM, Fidelis Assis wrote:
Can also be used for expansion of positional notation
s = '1010'
print((string.gsub(s, "()(.)", function (p, d) return ' + ' .. d ..
'*2^' .. #s-p end))
+ 1*2^3 + 0*2^2 + 1*2^1 + 0*2^0
and base conversion.
-- Fidelis
Not the same as using it in the replacement string.
--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.
- References:
- Use-cases for string.gsub(str, "().", "%1"), Soni L.
- Re: Use-cases for string.gsub(str, "().", "%1"), Matthew Wild
- Re: Use-cases for string.gsub(str, "().", "%1"), Soni L.
- Re: Use-cases for string.gsub(str, "().", "%1"), Fidelis Assis