[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A stupid question
- From: Enrico Colombini <erix@...>
- Date: Fri, 11 Jan 2002 18:19:23 +0100
>function change (src, find, rep)
> src = gsub (src, "(%w+)", function (word)
> if word == %find then
> return %rep
> else
> return word
> end
> end)
> return src
>end
>
>> print(change("the theory abcthedef", "the", "THE"))
>THE theory abcthedef
>
> Is it what you wanted?
Yes, I think that will do the trick (and it doesn't look too costly in
terms of performance).
Thanks, I see that I have to learn to think more 'functionally'... and
study better the examples in the manual :-)
Enrico