Add extra words

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Add extra words

Post by Rafi4 » 10 Aug 2019 06:35

Hi Martin and all
Is there any way to add extra words to a list or map.

For example
List=(good,cool,amazing);
Date=1565418759863,1565418769509,1565418989863
I want to add extra words to them e.g

good date [0],
cool date [1],
amazing date [2]
in message dialog. How can I?

thanks from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Add extra words

Post by Desmanto » 10 Aug 2019 16:48

Do you mean to combine two list?

If you need to do operation between 2 or more list, make sure all of them have the same length. Then you can loop upon the index from 0 to the last element, do the operation (combine), and store it into new list.

Code: Select all

list = newList("good", "cool", "amazing");
date = newList(1565418759863, 1565418769509, 1565418989863);

show = newList();
for(i in [0 to length(list)-1])
  addElement(show, list[i] + " " + date[i]);

msg = "{show,listformat}"
use {msg} in the message dialog.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Add extra words

Post by Rafi4 » 10 Aug 2019 17:17

Hi Desmanto
Thanks a lot.
list =(1565418759863,1565418769509,1565418989863)

How can I add " dateformat, dd-MM-yyyy hh-mm a" to above values to show as

10-12-2019 10-26 p.m
10-12-2019 10-46 p.m
10-12-2019 10-36 p.m.

thanks from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Add extra words

Post by Desmanto » 10 Aug 2019 17:48

I already guess you want to do that too :D Since you are going to use dateformat, it makes more sense just to use inline expression directly.

Code: Select all

list = newList("good", "cool", "amazing");
date = newList(1565418759863, 1565418769509, 1565418989863);

show = newList();
for(i in [0 to length(list)-1])
  addElement(show, "{list[i]} {date[i],dateformat,dd-MM-yyyy hh-mm a}");

msg = "{show,listformat}"
I remove the + and include the list into the inline expression.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Add extra words

Post by Rafi4 » 10 Aug 2019 23:00

Hi Desmanto
Working amazing. thanks from record4 .
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

Post Reply