FORUMS: list search recent posts

how can I take out a number in a string as an integer..????

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
theodora
how can I take out a number in a string as an integer..????
on Sep 1, 2006 at 4:12:54 pm

string $A = "crv.cv[15]";

let's say we have a string like the above and we want to take out the number in the string (in this case the number is 15) as an integer variable..Do you know how I can do this??

thanx,
theodora



Return to posts index

Steve Sayer
Re: how can I take out a number in a string as an integer..????
on Sep 1, 2006 at 6:45:55 pm

The first step is to isolate the numbers themselves. You can use the 'substring' or 'tokenize' commands to do this.

Once you have a string which contains only numbers, you can set an integer to be equal to it (int $myInt = $myString) and Maya will automatically convert the data to the appropriate type.

-Steve


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]