You don't want the index then. You want a combination of three things:
1) The substring TESTAPP_B_ABCD
2) The number of split strings or the number of underscores +1
Do you know how to do either or both of these independently? (
You should be able to figure out substring)