Using powerbuilder script, what is the easiest way to convert the string “0.5” to “50%”?
I’ve tried converting to Double first, but Double(“0.5”) returns 0..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do you have any specific decimal separator other than
.or,?In PB, the conversion from a string value to another type uses the regional settings. The same problem arises for converting other types like date or time.
Beware of the double (or float) type: floating point except for scientific computing is a painful path. Prefer the decimal type.
Here (with a coma as decimal separator) the following code seems to do what you are looking for: