How to separate parts of a string?

Let’s say I have a string that a player in my game can enter. He can enter the following:

kill SomePlayer123

tp SomePlayer123 AnotherPlayer123

spawn SomePlayer123

giveWeapon SomePlayer123 RandomPistol

My question isn’t about how to get killing and teleporting and spawning to work, but my question is how can I separate the player’s name from the command? I looked up compoundString.Split, but the thing is, tp and giveWeapon require 3 components. I know I could just separate based on spacebar, but what if the player’s name has a spacebar? Should I just make it where you can’t use spacebar as a name?

Finally, besides all that, what can I use to check if the player types ‘kill’ in general? Like if they type ‘kill SomePlayer123’, what will check to see if they typed kill in the first place? Wouldn’t be *, would it? Thanks. Sorry for my stupidity.

I’m not sure what compoundString is, but in C#, you would do it like this:

string xyz = "string1 string2 string3";
string[] array = xyz.Split(' ');
foreach (string token in array) {
    // Parse the commands

You don’t HAVE to prevent the player from having a space in their name. I mean you could get around that by doing some simple logic. For instance, if your command takes 3 parameters, but you see 4, you know the first one is the command, so take the 2nd parameter, look for it in the player array of names, and if it doesn’t exist, append the 3rd parameter to it, and look again. If it does exist, take the 3rd parameter and do the same thing, and if the name does exist (just the 3rd param), then the 4th parameter is an error. It can start slowing your code down if you allow any number of spaces, but if its just a first/last name type thing, then it probably wouldn’t impact it that much.

There’s really no simple way to handle it, other than prevent them from using spaces.