Re: formattedRead can't work with tab delimiter input

2017-09-19 Thread Ky-Anh Huynh via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 20:04:36 UTC, kdevel wrote: On Tuesday, 19 September 2017 at 13:28:22 UTC, Ky-Anh Huynh wrote: Hi, I want to read two fields from STDIN string key; double value; line_st.formattedRead!"%s %f"(key, value); Well it's so different from C. I would

Re: formattedRead can't work with tab delimiter input

2017-09-19 Thread kdevel via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 13:28:22 UTC, Ky-Anh Huynh wrote: Hi, I want to read two fields from STDIN string key; double value; line_st.formattedRead!"%s %f"(key, value); Well it's so different from C. I would use this: --- auto t = line_st.split.join (' ');

formattedRead can't work with tab delimiter input

2017-09-19 Thread Ky-Anh Huynh via Digitalmars-d-learn
Hi, I want to read two fields from STDIN string key; double value; line_st.formattedRead!"%s %f"(key, value); However, if the input line contains \t and it doesn't contain any space, the code doesn't work as expected. If there is a space, it works well a[space]1 #