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

Ali Çehreli acehreli at yahoo.com
Fri Mar 4 10:42:28 UTC 2022


On 3/4/22 01:53, Salih Dincer wrote:
 > On Friday, 4 March 2022 at 07:55:18 UTC, forkit wrote:
 >> If you get this question at an interview, please remember to first ask
 >> whether it's ascii or unicode 😀
 >
 > ```d
 > auto UTFsample = `
 > 1 İş 100€, 1.568,38 Türk Lirası
 > çarşıda eğri 1 çöp 4lınmaz!`;
 >
 > UTFsample.splitNumbers.writeln; // [1, 100, 1, 568, 38, 1, 4]
 > ```

I think what forkit means is, should the function consider numbers made 
of non-ascii characters as well? For example, the ones on this page:

   https://www.fileformat.info/info/unicode/category/Nd/list.htm

Typical to any programming task, all of us made assumptions on what 
actually is needed. :)

Ali



More information about the Digitalmars-d-learn mailing list