User input parsing

2015-10-14 Thread Joel via Digitalmars-d-learn
Is there a fast way to get a number out of a text input? Like getting '1.5' out of 'sdaz1.5;['. Here's what I have at the moment: string processValue(string s) { string ns; foreach(c; s) {

Re: User input parsing

2015-10-14 Thread Ali Çehreli via Digitalmars-d-learn
On 10/14/2015 12:14 AM, Joel wrote: Is there a fast way to get a number out of a text input? Like getting '1.5' out of 'sdaz1.5;['. Here's what I have at the moment: string processValue(string s) { string ns; foreach(c; s) {

Re: User input parsing

2015-10-14 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 07:14:45 UTC, Joel wrote: Is there a fast way to get a number out of a text input? Like getting '1.5' out of 'sdaz1.5;['. Here's what I have at the moment: string processValue(string s) { string ns;

Re: User input parsing

2015-10-14 Thread Joel via Digitalmars-d-learn
Thanks guys. I did think of regex, but I don't know how to learn it.