Get "de-string" an expression
|
03-09-2015, 01:11 PM
(This post was last modified: 03-09-2015 01:22 PM by Angus.)
Post: #1
|
|||
|
|||
Get "de-string" an expression
When given a String like "#AAh". How can that be changed to an integer constant #AAh?
I had in mind that CAS(String) is a way to convert a String to its (cas)meaning. Is that right? And why would that not work in the given example. Please also look at the code: Code: EXPORT INT_HEX(X) edit: remembering Han's tutorial about cas programs I tried locally assigning str:="#"+X+"h"; CAS(str); which SEEMS to work better, but apparently always leads to everything but the desired result.... dec semms to be preferred. Can someone help with the functionality I am looking for? |
|||
03-09-2015, 01:24 PM
Post: #2
|
|||
|
|||
RE: Get "de-string" an expression
Code:
That works. But I do not understand what CAS() is doing to integers. |
|||
03-09-2015, 01:56 PM
Post: #3
|
|||
|
|||
RE: Get "de-string" an expression
R→B(approx("#AAh")); // Who would have thought?
|
|||
03-09-2015, 02:02 PM
Post: #4
|
|||
|
|||
RE: Get "de-string" an expression
Cool to see an other working solution! Thank you.
However is using approx() so obvious that I should sense cynicism in your comment? I am not sure. |
|||
03-09-2015, 02:17 PM
Post: #5
|
|||
|
|||
RE: Get "de-string" an expression
No cynicism intended, although I see your thinking on my poor phrasing! It's just that I tried various tools, while scanning through the catalog, and happened to land on "approx()." I never would have guessed that to be a viable solution! Damn good thing it wasn't Zapprox, or I would've been here until the next blue moon, whenever that is!
-Dale- |
|||
03-09-2015, 02:38 PM
(This post was last modified: 03-09-2015 02:38 PM by Angus.)
Post: #6
|
|||
|
|||
RE: Get "de-string" an expression
How would you classify your solution? Is it intended or logical behaviour or is it just working out of luck? Or to put it in other words? How high of a risk do you see to be confronted with non working code after a future firmware update?
The cleanest solution is the best solution. What could it be. |
|||
03-09-2015, 05:11 PM
Post: #7
|
|||
|
|||
RE: Get "de-string" an expression
Hello,
is EXPR what you are looking for? Cyrille |
|||
03-10-2015, 05:47 AM
Post: #8
|
|||
|
|||
RE: Get "de-string" an expression
Best solution I would say :-) Thank you
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)