Re: (sub)string comp
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: (sub)string comp
- From: Alexandre Rion <gaumerie@...>
- Date: Sat, 1 Dec 2012 14:59:20 +0100
or
if str:find('^'..sub) then ... end
-----Message d'origine-----
From: Luiz Henrique de Figueiredo
Sent: Saturday, December 01, 2012 2:40 PM
To: Lua mailing list
Subject: Re: (sub)string comp
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
Try
str:find(sub,i,true)==i