Jump to content
Arthur Spooner

Using ATOI (vex)

Recommended Posts

I have a string called iop; s@iop = "sphereAdj"; followed by I want to convert the string into an integer

int atoi ("sphereAdj"); I get an error, I also tried the string attribute, in other words; int atoi (iop) but got an error as well ?

Share this post


Link to post
Share on other sites

well atoi() converts string that represents integer number into an integer number, like :

i@foo = atoi("123");

will give you 123 as an integer

so it can't be any any random string, you will get 0 with non-numeric string however, not an error, so if you got an error, your syntax was probably not correct

but to get an integer number from any string you can maybe use random_shash()

http://www.sidefx.com/docs/houdini15.0/vex/functions/random_shash

i@foo = random_shash("sphereAdj");

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×