[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: numeric captures (string.find)
- From: Asko Kauppi <asko.kauppi@...>
- Date: Wed, 15 Sep 2004 00:34:24 +0300
Would it be hard to make 'string.find()' return true numbers (not
strings with numerical contents, as now):
local _,_, a,b= string.find( "42 world", "(%d+)%s+(.+)" )
I believe this little change would be welcome, and not cause major
headaches in applications (they now have 'tonumber()', which would
become irrelevant but work the same).
What do you think - would it get any votes?
ps. I tried to fix this with a small wrapper, but it gets very
inefficient since the pattern string would need to be analyzed for each
'string.find' call. Doing it within strlib would just concern the case
when the capture really is numeric, right?