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

BoQsc vaidas.boqsc at gmail.com
Thu Mar 3 12:14:13 UTC 2022


I need to check if a string contains integers,
and if it contains integers, remove all the regular string 
characters.
I've looked around and it seems using regex is the only closest 
solution.

```
import std.stdio;

void main(string[] args){

	if (args.length > 1){
	
		write(args[1]); // Needs to print only integers.
		
	} else {
		write("Please write an argument.");
	}
}
```


More information about the Digitalmars-d-learn mailing list