There's more...

This recipe is written with the assumption that you want to use stdin for live interaction over the cli. If you plan on instead piping some data into it (for example, cat foo.txt | stdin.rs on *nix), you can stop treating the iterator returned by lines() as infinite and retrieve the individual lines, not unlike how you retrieved the individual parameters in the last recipe.

There are various calls to trim() in our recipe [35, 45 and 55]. This method removes leading and trailing whitespace in order to enhance the user-friendliness of our program. We are going to look at it in detail in the Using a string section in Chapter 2, Working with Collections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.220.83