There was a post recently where I used Split for solid body names https://forums.autodesk.com/t5/inventor-forum/adding-prefix-to-body-name/m-p/10431354#M832600. Works very well for this situation.
The below splits the part number using the special character "-" as a reference to where to stop counting. The string is then directly linked to Project Text parameter or wherever you like.
Dim PartNo As String
PartNo = iProperties.Value("Project", "Part Number")
'Creats an array of strings seperated by "-"
myparams = PartNo.Split("-")
replaceString1 = myparams(0)'123456
replaceString2 = myparams(1)'01
replaceString3 = myparams(2)'01
MessageBox.Show(replaceString1, "Title")
MessageBox.Show(replaceString2, "Title")
MessageBox.Show(replaceString3, "Title")
Dim Name As String
'Place the Name into a parameter or use it in some way.
'You can use input box to select which string you want to use, or in this case just to show the array contents
'Name = InputListBox("Prompt", myparams, d0, Title := "Title", ListName := "List")
'By pass selection box and use direct link
Name = replaceString1
'Create text parameter called "Project" first manually
Project = Name
MessageBox.Show(Name , "Title")
Here is another where the array of strings are fed into an input box and you can pick what to use .
Dim PartNo As String
PartNo = iProperties.Value("Project", "Part Number")
'Creats an array of strings seperated by "-"
myparams = PartNo.Split("-")
replaceString1 = myparams(0)'123456
replaceString2 = myparams(1)'01
replaceString3 = myparams(2)'01
MessageBox.Show(replaceString1, "Title")
MessageBox.Show(replaceString2, "Title")
MessageBox.Show(replaceString3, "Title")
Dim Name As String
'Place the Name into a parameter or use it in some way.
'You can use input box to select which string you want to use, or in this case just to show the array contents
Name = InputListBox("Prompt", myparams, Name, Title := "Title", ListName := "List")
'Create text parameter called "Project" first manually
Project = Name
MessageBox.Show(Name, "Title")
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan