I found a good solution but not exactly for my problem:
String s = "abc.def.ghfj.qert";
s.substring(s.lastIndexOf(".") + 1)
Source: Java: Getting a substring from a string starting after a particular character
This I have to use it within an array, but I have NO idea how to do... sorry.
I got the following code:
a = [];
b=getLinkedItems(item("link_M"))
for(i in 0..b.size()-1)
{ a[i] = b.getAt(i).toString().reverse().substring(0,1) }
total = 0
for(x in a) { total = total +","+x }
val = total.substring(2)
This is my result:
[b] = [java.util.ArrayList] [
Group:m.1:book1150:MGROUP.6/M/m.1,
Group:m.6:book1150:MGROUP.6/M/m.6,
Group:m.9:book1150:MGROUP.6/M/m.9]
[a] = [java.util.ArrayList] [1, 6, 9]
[total] = "0,1,6,9"
[val] = "1,6,9"
... but it is not practicable if my array contains a value greater than 9.
What can I do if my array is e.g.:
[b] = [java.util.ArrayList] [
Group:m.1:book1150:MGROUP.6/M/m.1,
Group:m.6:book1150:MGROUP.6/M/m.6,
Group:m.9:book1150:MGROUP.6/M/m.12]
and my result should be:
[val] = "1,6,12"
Who can help me? Where do I have to write e.g. "lastIndexOf(".")" or do anyone have a better solution?
Thank you in advance.