How to Get Portion of String

If I have an index, which I want to retience from the transform’s name… so, transform1, will be index 1… I want this index value to be gathered after start. So, if transform.name == transform1, how do I get that 1 value, and apply it to my index int?

Thanks

https://www.google.com/search?q=How+to+Get+Portion+of+String

Do you mean you want something like this?:

int index = Convert.ToInt32(transform.name.Substring(transform.name.Length-1, 1));

Not tested, but should return the value of the last character in the transform’s name.
Warning, if the character ISN’T a number, it may error. Wrap in a TRY / CATCH block to be sure maybe

[EDIT] Actually, this won’t work if the number is more one digit (greater than 9). It may get tricky to determine how many valid numerical characters are at the end using a simple command.

Thank you.