[OpenSCAD] what base language is used in OpenSCAD

ken at volksswitch.org ken at volksswitch.org
Fri Apr 27 20:32:09 EDT 2018


Cool, thanks!

Ken

 

From: Jordan Brown [mailto:openscad at jordan.maileater.net] 
Sent: Friday, April 27, 2018 6:12 PM
To: OpenSCAD general discussion; ken at volksswitch.org
Subject: Re: [OpenSCAD] what base language is used in OpenSCAD

 

On 4/26/2018 2:51 PM, ken at volksswitch.org wrote:

I'd like to be able to convert a string to an integer in OpenSCAD.  For
example:

 

string = "11";

number = xxx(string);



Here's what I come up with:

function atoi1(s, n) = n < 0 ? 0 : atoi1(s, n-1)*10 + search (s[n],
"0123456789")[0];
function atoi(s) = atoi1(s, len(s)-1);
echo(atoi("123"));

It seems like it could be simplified a bit.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180427/31d9f9e8/attachment.html>


More information about the Discuss mailing list