Hi everyone
I’m getting a numeric string with a value that looks like this: 1,987.00
And I want to change it to number (don’t need the comma only the dot, in case of a decimal value).
because later I’m doing some math on this value…
THANKS IN ADVANCE
Double.Parse(str).ToString
where str is the variable name where your string is stored.
Please mark as solution if it fixes your issue
it didn’t work.
it gave me this error
where the GreenPremium is the double variable that I want in the end
and the PremiumTemp is the string that I wanna change
You are using assign activity? write line?
If assign - remove .toString
Use only Double.Parse(str)
If writeline - you should use along with write line.
removing .toString should work fine.
1 Like
I would recommend using If Double.TryParse(PremiuTemp,GreenPremium) = true
Assign
GreenPremium=PremiuTemp
it worked
but if at the end I have “.00” it will disappear (if I will have “.09” it will show it)
thank you very much
P.S
@Lakshay_Vermawhy should I use IF?
when can it happen that I wont be able to convert from string to double??
and again thank you very much
2 Likes
What if the string variable does not contain a double value.
If your variable string contains alphabets.
PremiuTemp=“abc” in this case your code with throw error.
That is correct
but Where I’m taking the details from suppose to be correct and without a problem
thank you for the food for thought…
Okay.
Just that, I have encountered these problems a lot, so made this more of a habit to try and assign.
But as stated, It’s good if confirmed that details are correct.
1 Like
system
(system)
Closed
June 20, 2020, 2:50pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.