Stuck with splitting SMS !?

Hello,

I'm new here and new in programming over all. I'm trying to make an app that involves receiving SMS and gathering information for later usage. Let' say I receive SMS as:

123
456
789

I'd like to split SMS at line feeds and store it to a local list for later usage. Here are my blocks:

This is for testing purpose only. I'd expect to get something like 123 : 456 : 789 : but I get ["123","456",789"] : in my Textbox1

I don't quite understand how to split SMS to make each line a list item as this is not working as expected.
How to do it correctly? Any help appreciated.

Cheers

The split block just splits the text into a list.
Retrieving the correct index is our job :wink:

Let's not complicate our lives

1 Like

Hi Silvo

Normally after splitting you would display the items by loading them into either a ListView or List Picker. Also, \n is the correct assumption for the EOL if the message came from an Android phone, but if it originated from a Windows OS or Apple OS, the EOL is different.

Your split code is a little bit off:
SplitSMS.aia (2.7 KB)

1 Like

If a list is needed, the blocks may look like this. No loop processing is necessary here.

1 Like

Capture

I have already provided the same above :slight_smile:

1 Like

Thanks people,
I realized that my mistake was to use a block "add item to list" instead of "set 'Split_sms' to" block as shown in ChrisWard's and Patryk_F's solution. Now I can get going on my project... hopefully.
Again thank you for your kind assistance,
Silvo

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.