Split a str until the nth occurrence and get the rest

I am searching for the most elegant and least copy / allocation to get substrs that are divided by spaces, but also get the rest of the str regardless of all the spaces in it after the nth space.

As an example, I have the following str:

value1 value2 value3 the rest of the str with many spaces in it

Now I want to have strs containing: "value2" and "the rest of the str with many spaces in it". I can of course split the str and have access to the first values, but how do I get the rest? I'd need at least something like "find the position of the third space in this str".

See the splitn method:

1 Like

Oh well, just missed that. Thanks a lot!