Cableguy Expert Licensed User Longtime User Apr 23, 2015 #1 Hi guys... I have a file that has or will have some relative string values like "1.3%x"... but if I feed this string into a map and try to use it as an integer... it fails... obviously... How can I parse this relative string into an integer? Thanks
Hi guys... I have a file that has or will have some relative string values like "1.3%x"... but if I feed this string into a map and try to use it as an integer... it fails... obviously... How can I parse this relative string into an integer? Thanks
DonManfred Expert Licensed User Longtime User Apr 23, 2015 #2 Get the needed subpart of the string (1.3) and cast it to a float or double 1.3 can not be an int. Maybe i did not understand the question right. Dont know what you mean with "relative string" Upvote 0
Get the needed subpart of the string (1.3) and cast it to a float or double 1.3 can not be an int. Maybe i did not understand the question right. Dont know what you mean with "relative string"
Cableguy Expert Licensed User Longtime User Apr 23, 2015 #3 the string is a screen relative percentage like in the example 1.3%x... if I put this into the map without the quotes it works and gets converted to an integer screen value... but with the quotes I get an error... so i'm guessing I will have that error once I read that value from a file ( not yet implemented) Upvote 0
the string is a screen relative percentage like in the example 1.3%x... if I put this into the map without the quotes it works and gets converted to an integer screen value... but with the quotes I get an error... so i'm guessing I will have that error once I read that value from a file ( not yet implemented)
DonManfred Expert Licensed User Longtime User Apr 23, 2015 #4 Sadly b4a does not have a "eval" Write the real int behind the relative value into the file and read the int back instead of a string. Code: Copy log(1.3%x) You can write the int value to a file. for the rest you can use YOUR brain Upvote 0
Sadly b4a does not have a "eval" Write the real int behind the relative value into the file and read the int back instead of a string. Code: Copy log(1.3%x) You can write the int value to a file. for the rest you can use YOUR brain
Cableguy Expert Licensed User Longtime User Apr 23, 2015 #5 Lol.... I found a workaround... Not in parsing but in my way of making my calculations Upvote 0
RandomCoder Well-Known Member Licensed User Longtime User Apr 23, 2015 #6 Cableguy said: Lol.... I found a workaround... Not in parsing but in my way of making my calculations Click to expand... Hi @Cableguy is this for what I think it is Just store the value you want to use and then multiply it by 1%x or 1%y as required. Upvote 0
Cableguy said: Lol.... I found a workaround... Not in parsing but in my way of making my calculations Click to expand... Hi @Cableguy is this for what I think it is Just store the value you want to use and then multiply it by 1%x or 1%y as required.
Cableguy Expert Licensed User Longtime User Apr 23, 2015 #7 indeed... I'll send you a new dropbox link ... decided to re-think the whole initialization procedure... Upvote 0
indeed... I'll send you a new dropbox link ... decided to re-think the whole initialization procedure...