Removing newline at end of string variable.

832 views
Skip to first unread message

technogeezer

unread,
Jan 17, 2014, 11:29:23 AM1/17/14
to tas...@googlegroups.com
I have a string variable that appears in a flash action like this,

words
two words
three more words

I use variable split to split the above into %tmp, splitting on the word 'two'.  When I flash print %tmp1, I get the word 'words' but the flash container is twice as tall as usual which looks to me like it has a blank line.

I have tried variable search replace on \n, \x0a and every other variation I can think of.  Does anyone know if carriage returns can be removed and if so, what the correct syntax is?

Sorry if this has a really simple answer or has been answered previously.

Thanks

Rich D

unread,
Jan 17, 2014, 11:39:45 AM1/17/14
to Tasker Google Groups Post

You can just split on the CR and that will eliminate all of them. You need to set a local variable to the CR and then use that variable as the splitter.

Bob Hansen

unread,
Jan 17, 2014, 11:51:42 AM1/17/14
to tas...@googlegroups.com
Or you could use variable search replace like this:

Variable Search Replace:[ %tmp Search:.+   Store matches in: %result ]
Flash %result1

The .+ will match all characters except line breaks.

technogeezer

unread,
Jan 17, 2014, 11:53:16 AM1/17/14
to tas...@googlegroups.com
Rich D, thanks for your response.

However, I tried this,

variable set %tcr to \n
variable split name %input Splitter %tcr
flash %input1

This did not work.  The split did not occur.

Rich D

unread,
Jan 17, 2014, 11:57:37 AM1/17/14
to Tasker Google Groups Post

To make the splitter you just go into the text field of the variable set and press a CR.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.

Bob Hansen

unread,
Jan 17, 2014, 12:00:21 PM1/17/14
to tas...@googlegroups.com
Don't use \n use the actual "enter" key.

technogeezer

unread,
Jan 17, 2014, 12:02:32 PM1/17/14
to tas...@googlegroups.com
Thanks, Bob Hanson.  That worked.

technogeezer

unread,
Jan 17, 2014, 12:04:57 PM1/17/14
to tas...@googlegroups.com
Thanks, Rich D.  That worked as well.

Reply all
Reply to author
Forward
0 new messages