There are a couple of methods to get substrings from a string, but I cant figure out which to use to trim my string so that the last "_D4" is removed.
Example of original string:
"A1_B2_C3_D4"
Since each number after each letter does not have to consist of one digit, the string can be of various length, so using substringToIndex alone wont do.
I guess what I have to do is to first find the index of the last occurrence of "_". I just cant figure out which method to use to get that index.
Example of original string:
"A1_B2_C3_D4"
Since each number after each letter does not have to consist of one digit, the string can be of various length, so using substringToIndex alone wont do.
I guess what I have to do is to first find the index of the last occurrence of "_". I just cant figure out which method to use to get that index.