Page 1 of 1

String processing

Posted: 24 May 2014 05:48
by apshergill91
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

Re: String processing

Posted: 25 May 2014 12:50
by Martin
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

Re: String processing

Posted: 27 May 2014 02:29
by apshergill91
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

Re: String processing

Posted: 27 May 2014 08:57
by manuel
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

Re: String processing

Posted: 27 May 2014 15:44
by Martin
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.