[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Filtering chars from string
- From: Scott Morgan <blumf@...>
- Date: Tue, 27 Aug 2019 13:46:20 +0100
On 27/08/2019 10:44, Luiz Henrique de Figueiredo wrote:
> On Tue, Aug 27, 2019 at 5:55 AM Scott Morgan <firstname.lastname@example.org> wrote:
>> What's the best way to filter out non-specified chars from an ASCII
>> string? (so no need to worry about UTF8, etc.)
>> local allowed = "AbC"
>> local txt = "dDcCbBaA"
>> filter(txt, allowed, "") -- ret: "CbA"
>> filter(txt, allowed, "?") -- ret: "???Cb??A"
> function filter(t,a,r)
Doh! Knew I was missing something simple, hence the question.
Is there a limit to how big those sets can be? In practice I'd be
looking at a few dozen allowed chars.