[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String manipulation
- From: Ico Doornekamp <lua@...>
- Date: Fri, 31 Oct 2014 18:39:45 +0100
* On 2014-10-31 18:33:07 +0100, Emeka wrote:
> mystring = "google+facebook"
>
> mysringlen = string.len(mystring)
>
> for i = 1, mystringlen do
> dosomething(mystring.sub(i,i))
> end
>
> Is there a better way of doing the above? If yes, please throw it to me :)
More concise would be
mystring:gsub('.', dosomething)
but 'better' might depend on other criteria like perormance. Measure to
be sure.
--
:wq
^X^Cy^K^X^C^C^C^C