Making input limitations

Hello everyone;

i have been creating a game and i need your helps. Let me know, how can i make a limitations for input. I mean, users will click the new player button and write a profile name but players can enter a name which has maxiumun 10 characters. Therefore, how can i make this limitations.

Sincerely
john

Hello, you can simply check String.Lenght property

thank you lacost

However i can find the char number in the string. But my problem is that, if user try to enter name is bigger than 10 character , the program will automatically not accept the 11th char i mean, 11th char will be automatically deleted by program. How can i do that?

Sincerely

You can do something like

if(characterName.Length > 10) {
	characterName = characterName.Substring (0, 10);
}

thank you again