Converting number in script

Getting started -basics for starting with WinTask

Converting number in script

Postby Yasir on Wed Feb 26, 2014 9:42 am

Hi,

I read a string like: String1$ = "0.5"

I have to multiply this string by 100. This code does not work.

xVal = Val(String1$)
xVal2 = xVal * 100
xName$ = str$(xVal2)
Yasir
 
Posts: 18
Joined: Tue Jun 21, 2005 5:18 pm

Re: Converting number in script

Postby TechSupport on Thu Feb 27, 2014 8:48 am

Hello,

Val converts a string representing an integer to a number. For a real number, you need to use the WinTask functions applying to real numbers:
result$=Multiply$("0.5",100)
and then
number=Val(result$)

Best regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am


Return to Getting started

Who is online

Users browsing this forum: No registered users and 0 guests

cron