I have a string that looks like this
svchost.exe 4464 Services 0 47.656 K
note that there are many spaces and the amount of spaces are different in each case
I want to extract the name svchost.exe and the pid 4464. I would be able to do this, but only with the imperative way. Its hard for me to think in a functional way to solve this problem.
It is possible to solve this with regex but I want to see how you do something like this with functional programming.
Easy peasy:
UPDATE
or use
s.split(" +")which relies on regexp beauty