PDA

View Full Version : access to string characters


sepehr
12-10-2005, 08:07 PM
Hi;
I have a string like “Hello world!” and want to have access to each individual character of this string and send it to be used in MyProcedure MEL procedure.
Something like this in other C-like programming languages:

string $test1=“Hello world!”;
MyProcedure ($test1.charAt($index));

How is it possible to do it in MEL?
Thank you for your time.
Sepehr

brubin
12-10-2005, 08:56 PM
Hi;
I have a string like “Hello world!” and want to have access to each individual character of this string and send it to be used in MyProcedure MEL procedure.
Something like this in other C-like programming languages:

string $test1=“Hello world!”;
MyProcedure ($test1.charAt($index));

How is it possible to do it in MEL?
Thank you for your time.
Sepehr

{string $test1="Hello world!";
int $mySize = `size($test1)` ; // solely FYI: this returns how many chars in your string
int $choice = 4 ;// pick one, i randomly choose 4
string $oneChar = `substring $test1 $choice $choice` ;
print $oneChar ;
}


// substring: (from the manuals)
// The first argument is the input string. The second and third arguments are the starting and ending positions
// within the input string.
// substring returns the portion of the first string argument bounded by starting and ending positions.

HIH
s.

sepehr
12-11-2005, 10:49 AM
Thanks.
The "string" was not a good term to be searched in Maya Help.
There were more than 1000 results sound,...

CGTalk Moderation
12-11-2005, 10:49 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.