Would any one help me to solve the problem???

for example: 12345/abc123

I want to divide the above string into two value,

- 12345
- abc123

I want to know how can the program recognize the value in each digit???
And how can the program recognize the "/" to divide into two string???

Thank you very much~~

Hi,

use instr to find the '/'
then left and right to get the two halves.

Dim x As String
    Dim slash As Integer
    Dim lCode, rCode As String
    
    x = "1234/abc123"
    slash = InStr(1, x, "/")
    
    If slash = 0 Then
        MsgBox "No Slash in code"
        Exit Sub
    End If
    
    lCode = Left$(x, slash - 1)
    rCode = Right$(x, Len(x) - slash)
    
    Label1 = lCode
    Label2 = rCode
    Label3 = x

Split.

' /* Specifically For Yomet ;) */
dim str as string
dim parts() as string
dim part1 as string
dim part2 as string

str = "12345/abc123"
parts = split(str, "/")
part1 = parts(0)
part2 = parts(1)

Now the variable part1, will be 12345, and the variable part2 will be abc123.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.