Decreasing Length of a String?

Hey guys, I am trying to make a string adjust perfectly in its length. I am using this code:

if(k.Killer.Length > maxString)
				k.Killer.Length = Mathf.Clamp(k.Killer.Length, 0, maxString);
				k.Killer = k.Killer += "...";

The problem is that String.Lenght is read only and cannot be manipulated, anyone know how to change this? I want the amount of characters in the string to equal maxString.


String.Substring() will do the job. You want the two parameter version so it will:

k.killer = k.killer.Substring(0, maxString);

For future people finding this, you can also use string range from the System namespace:

nameSub = name[..5];

Where the range is the number of characters you want to keep.