# Breaking down a string

• ### Question

• User1126507225 posted

I am a beginner and trying to learn. My problem is I am trying to break down a string for a part number. The string looks like" ABCD259A8755" . I need to separate it to sections like ABCD, 2, 5, 9, A, 8, 75, 5, . Can anyone help?

Thursday, April 2, 2009 8:07 PM

• User1052258516 posted

If the string is a fixed length string ie. always equals 12 characters like your sample then take a look at the Substring method on the string

• Marked as answer by Thursday, October 7, 2021 12:00 AM
Thursday, April 2, 2009 10:09 PM
• User77042963 posted

You can use SUBSTRING function to extract your string part Here is how to get the first 4 and concatenate it with the following one:

Dim mystring As String = "ABCD259A8755"

Dim myAnotherString As String = String.Empty

myAnotherString = mystring.Substring(0, 4) & "," & mystring.Substring(4, 1)

'ABCD,2
• Marked as answer by Thursday, October 7, 2021 12:00 AM
Thursday, April 2, 2009 11:17 PM

### All replies

• User1052258516 posted

If the string is a fixed length string ie. always equals 12 characters like your sample then take a look at the Substring method on the string

• Marked as answer by Thursday, October 7, 2021 12:00 AM
Thursday, April 2, 2009 10:09 PM
• User-1501102275 posted

Is the breakdown always predictable just like "ABCD, 2, 5, 9, A, 8, 75, 5" for instance?

Thursday, April 2, 2009 10:42 PM
• User77042963 posted

You can use SUBSTRING function to extract your string part Here is how to get the first 4 and concatenate it with the following one:

Dim mystring As String = "ABCD259A8755"

Dim myAnotherString As String = String.Empty

myAnotherString = mystring.Substring(0, 4) & "," & mystring.Substring(4, 1)

'ABCD,2
• Marked as answer by Thursday, October 7, 2021 12:00 AM
Thursday, April 2, 2009 11:17 PM