Hi . I have a string like this "10_aString_1-1" ,now how can i get only the "aString_1"
Thank you for your time
Kostas
Hi . I have a string like this "10_aString_1-1" ,now how can i get only the "aString_1"
Thank you for your time
Kostas
A$=“10_aString_1-1”
B$=Mid(A$,4,9)
A$ = "x_xxx_xx_xx-x"
B$ = Split(A$, "-", 1)
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
That's wrong Sam, even removing the '1' from the Limit of the split stil leaves the first part of the string (10_) which the op doesn't want.
Semper in excretia sumus; solum profundum variat.
Hi Thank you all for your anwsers but i'd like to be more dynamic the search . For example if the string is "1003_twoString_12-1" or "10003_threeString_123-1" then how can i get it the "twoString_12" or "threeString_123"
Regards
Kostas
Good eye. However, just removing the limit of Split make B$ an array with 2 elements
B$ = Split(Split(A$, "-", 1), "_")(1) & "_" & Split(Split(A$, "-", 1), "_")(2)
Better might be
$B = Mid(A$, (Instr(A$, "_") + 1), (Len(A$) - (Instr(A$, "-") + 1)))
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
OK Thank you very much SamT
$B = Mid(A$, (Instr(A$, "_") + 1), (Len(A$) - (Instr(A$, "-") + 1)))