You need to sign in to do that
Don't have an account?
MMA_FORCE
Split a name?
I have an Object which the Name field starts with "AO-" Now within that is an autonumber. So the field would say for a record after created is AO-01856. How in an Apex Class just get the number from here and not the AO.
I am trying to create a new record for the child object which relates to the parent object.
Thanks
String has split() function, so name.split('-')[1] should be fine (but you should add more check just in case).
ThomasTT
string numstring = name.substring(3);
integer numvalue = integer.valueOf(numstring);