Find a char among string (string.findAmong.char)

jfondren julian.fondren at gmail.com
Mon Jul 5 19:48:13 UTC 2021


On Monday, 5 July 2021 at 19:34:14 UTC, BoQsc wrote:
>
> But I really don't like how it looks less readable and makes 
> less sense on first look.
> `if (([letter].findAmong(alphabet)).length)`
> I'd like to use some method on the `letter` instead of []
> And `.length` does not make a lot of sense when reading like an 
> english sentence.

I suggest canFind, like in my earlier example. findAmong is like 
"consume this range until you find one of these things, and then 
return the remainder of the range". It doesn't really fit your 
use.


More information about the Digitalmars-d-learn mailing list