String processing

Post your questions and help other users.

Moderator: Martin

Post Reply
apshergill91
Posts: 18
Joined: 07 Dec 2013 05:59

String processing

Post by apshergill91 » 24 May 2014 05:48

I would like to perform following operation on SMS text that I receive.

1. Find if it contains certain word
2. Find location of word in string
3. Count the no of their occurances of word in the string.
4. Remove empty lines in multi line string .

Regards

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: String processing

Post by Martin » 25 May 2014 12:50

Hi,

Please check the help page of action Script (or on the website here: http://automagic4android.com/en/help/co ... ion_script).

Following functions could be useful:
  • Boolean contains(String s, String search)
  • Number indexOf(String s, String search)
  • Number indexOf(String s, String search, Number start)
  • String replaceAll(String s, String regex, String replacement)
Regards,
Martin

apshergill91
Posts: 18
Joined: 07 Dec 2013 05:59

Re: String processing

Post by apshergill91 » 27 May 2014 02:29

I want to split the string based on nature of character i.e. alphabet,number,special character

Example -

String -ABC DETAILS 123456 ##$

RESULT -
ABC DETAILS
123456
##$

How Do I do that?
regards

manuel
Posts: 27
Joined: 05 Jul 2013 20:54

Re: String processing

Post by manuel » 27 May 2014 08:57

apshergill91 wrote:I want to split the string based on nature of character i.e. alphabet,number,special character

Example -

String -ABC DETAILS 123456 ##$

RESULT -
ABC DETAILS
123456
##$

How Do I do that?
regards
Use:

Code: Select all

List split(String s, String pattern)
Splits the string s into a list of strings by using the regular expression pattern as the delimiter. (see Regular expressions.)

See Action script and search for it

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: String processing

Post by Martin » 27 May 2014 15:44

The help page of action script also contains a link to a page with some examples:
http://automagic4android.com/automagic/ ... mples.html

The examples Create a list of lines from a multiline text and Create a list of words should be helpful.

Post Reply