How to remove all characters from a string, except the integers?

Salih Dincer salihdb at hotmail.com
Fri Mar 4 13:18:00 UTC 2022


On Friday, 4 March 2022 at 10:34:29 UTC, Ali Çehreli wrote:
> [...]
> isMatched() and chunkOf() are not necessary at all. I wanted to 
> use readable names to fields of the elements of chunkBy instead 
> of the cryptic t[0] and t[1]:

It's delicious, only four lines:
```d
"1,2,3".chunkBy!(n => '0' <= n && n <= '9')
          .filter!(t => t[0])
          .map!(c => c[1])
          .writeln;
```
Thank you very much for this information sharing...

SDB at 79



More information about the Digitalmars-d-learn mailing list