You don’t give very much information in your question, but from your code I’m assuming the following:
- You’re using Unity3D
 - You have a text input control that allows the user to enter commands.
 - Your 
if-elseblock cycles through all possible commands and completes the required action. - In this case, you are wanting to teleport to the location within the game that matches the value the user enters after entering “/teleport”.
 
I suggest taking the string input and shortening it, then parsing the remaining string using the ' ' separator.
This will give you a string array with the vector values.
Next, convert each string in this array to an int, and then you can assign these ints to variables to be used in determining a new location.
For example:
// Input: /teleport 30 146 18
else if (this.inputLine.StartsWith("/teleport")
{
    // Gets what the user typed.
    string input = inputLine.Text;
    // Removes the "/teleport" part of string.
    string vectorString = input.Substring(8);
    // Splits the remaining string into an array of values using ' ' delimiter.
    string[] va = vectorString.Split(' ');
    // Converts values from string to int.
    int x = Convert.ToInt32(va[0]);
    int y = Convert.ToInt32(va[1]);
    int z = Convert.ToInt33(va[2]);
    // Changes the position using these ints.
    transform.position = new Vector3(x, y, z);
}
As an alternative to creating a substring, you could split the string and then avoid using the first element of the array, assigning elements 2, 3, and 4 to the ints instead.
1
solved c# how to teleport to where I want