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

Stanislav Blinov stanislav.blinov at gmail.com
Fri Mar 4 21:20:20 UTC 2022


On Friday, 4 March 2022 at 19:51:44 UTC, matheus wrote:

> OK but there is another problem, I tested your version and mine 
> and there is a HUGE difference in speed:

>     string s, str = "4A0B1de!2C9~6";

> Unless I did something wrong (If anything please tell). By the 
> way on DMD was worse, it was like 5x slower in your version.

To add to the already-mentioned difference in allocation 
strategies, try replacing the input with e.g. a command-line 
argument. Looping over a literal may be skewing the results.



More information about the Digitalmars-d-learn mailing list