digitalmars.D.learn - How to Skip some field/word in formattRead?
- Ky-Anh Huynh (13/13) Sep 17 2017 Hi,
- kdevel (5/8) Sep 17 2017 ---
Hi, Is it possible to read just the second word from an input string and skip all others? "one two three".formattedRead!("%s %s", _, saveme) The point is I want to skip the first/third word (`one`, `third`) and read the second word (`two`) into the variable `saveme`. For now I have to declare temporary reference string _; "one two three".formattedRead!("%s %s %s", _, saveme, _); Well, `_` is acceptable; in my example, the value of `_` would be `three[\n]` Is there any better/cleaner way? Thanks for your reading.
Sep 17 2017
On Sunday, 17 September 2017 at 13:53:26 UTC, Ky-Anh Huynh wrote:Is it possible to read just the second word from an input string and skip all others? "one two three".formattedRead!("%s %s", _, saveme)--- import std.range; auto saveme = "one two three".split.array [2]; ---
Sep 17 2017