Text manipulation regex

tuffno

New member
Hello.
I've made 3 variables.
Lat = decimal
Long = decimal
LatLong = String
I use Share Location to variable LatLong.
Content looks like this 48.484344343,15.434323523
I then use Text Manipulation to extract the first number into Lat. And the second number into Long.
Lat = [0-9]*\.[0-9]+
Long = [0-9]*\.[0-9]+$

When I do this they aren't stored as decimals but as Strings.
This means that I can't use the comparator > or < in an if clause because Strings can only use = != comparators.

So basically I would like to either change a Variable from String to Decimal or force the content stored in a variable to match the Variabletype I created in the first place.
Thanks for any assistans.
 

Dm114

Well-known member
Hello.
I've made 3 variables.
Lat = decimal
Long = decimal
LatLong = String
I use Share Location to variable LatLong.
Content looks like this 48.484344343,15.434323523
I then use Text Manipulation to extract the first number into Lat. And the second number into Long.
Lat = [0-9]*\.[0-9]+
Long = [0-9]*\.[0-9]+$

When I do this they aren't stored as decimals but as Strings.
This means that I can't use the comparator > or < in an if clause because Strings can only use = != comparators.

So basically I would like to either change a Variable from String to Decimal or force the content stored in a variable to match the Variabletype I created in the first place.
Thanks for any assistans.
Use 'set variable (decimal) > expression > [...] button > string variable value > select string variable'.
 

Attachments

  • Screenshot_20210330-124405_MacroDroid.jpg
    Screenshot_20210330-124405_MacroDroid.jpg
    129.6 KB · Views: 43

tuffno

New member
I cant find the action Set dec.
When i create a var i cant choose expressions. Only type and name. I must be looking in the wrong place.
 
Top