(sub)string comp
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: (sub)string comp
- From: spir <denis.spir@...>
- Date: 2012年12月01日 14:26:21 +0100
Hello,
I have the impression to miss an obvious point (again). In all kinds of string
processing (and even more in parsing), we constantly need to check whether a
given substring is present at a given index in a string. I don't see any other
way to do that in Lua than:
if (str:sub(i, i-1+sub:len()) == sub) then ... end
That is, to make a new (sub)string and compare it with the original one. Hum. Am
I overlooking a trivial & efficient solution?
Denis