POV-Ray : Newsgroups : povray.general : Turn a string of digits into a number? Server Time
22 Dec 2024 08:21:44 EST (-0500)
  Turn a string of digits into a number? (Message 1 to 4 of 4)  
From: Jonathan Bush
Subject: Turn a string of digits into a number?
Date: 1 Dec 2021 18:30:00
Message: <web.61a80414e484efb8d80ced0afde6c206@news.povray.org>
String functions for POVray include ways to turn a numerical value into a
string. But is there a function to do the converse, turn a string of digits into
an integer? Of course there is a workaround, use a loop and multiply the value
you have by 10 with each iteration as you examine the string from left to right.
That seems awkward to me. Please tell me I missed something.

My specific task is to write a script that will parse move notation for a board
game and produce an image of the position, possibly animated.

Thanks


Post a reply to this message

From: Bald Eagle
Subject: Re: Turn a string of digits into a number?
Date: 1 Dec 2021 21:55:00
Message: <web.61a8348efbbd28521f9dae3025979125@news.povray.org>
"Jonathan Bush" <djb### [at] gmxcom> wrote:
> String functions for POVray include ways to turn a numerical value into a
> string. But is there a function to do the converse, turn a string of digits into
> an integer?

You want val().

http://www.povray.org/documentation/view/3.6.1/228/

val(S) Convert string S to float. Returns a float value that is represented by
the text in string S. For example val("123.45") is 123.45 as a float.


Post a reply to this message

From: Jonathan Bush
Subject: Re: Turn a string of digits into a number?
Date: 2 Dec 2021 19:25:00
Message: <web.61a962ccfbbd2852d80ced0afde6c206@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Jonathan Bush" <djb### [at] gmxcom> wrote:
> > String functions for POVray include ways to turn a numerical value into a
> > string. But is there a function to do the converse, turn a string of digits into
> > an integer?
>
> You want val().
>
> http://www.povray.org/documentation/view/3.6.1/228/
>
> val(S) Convert string S to float. Returns a float value that is represented by
> the text in string S. For example val("123.45") is 123.45 as a float.

Thank you! I missed that. I don't see any way to change the subject to include
the word Solved, using a browser.


Post a reply to this message

From: Alain Martel
Subject: Re: Turn a string of digits into a number? [solved]
Date: 3 Dec 2021 11:10:40
Message: <61aa4180$1@news.povray.org>
Le 2021-12-02 à 19:20, Jonathan Bush a écrit :
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> "Jonathan Bush" <djb### [at] gmxcom> wrote:
>>> String functions for POVray include ways to turn a numerical value into a
>>> string. But is there a function to do the converse, turn a string of digits into
>>> an integer?
>>
>> You want val().
>>
>> http://www.povray.org/documentation/view/3.6.1/228/
>>
>> val(S) Convert string S to float. Returns a float value that is represented by
>> the text in string S. For example val("123.45") is 123.45 as a float.
> 
> Thank you! I missed that. I don't see any way to change the subject to include
> the word Solved, using a browser.
> 
> 
> 
> 
In a news group, you can't change the title of the thread. All you can 
do is change the title of your reply like I did in Thinderbird.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.