Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 06-02-2006 , 08:13 AM
Registered User
Join Date: Feb 2006
Posts: 2

add substrings to an array

hi folks,

i have a string of numbers which i want seperated so that every figure has its own place in an array. i tried it this way, but i couldn't get it working:

proc dothis()

{
print ("barcode" + "\n");
global string $barcode;

$barcode _= `textField -query -text barcode1`;

for ($i=1; $i<=(size($barcode)); $i++) {

$barpiece =`substring $barcode $i $i`;
global string $barc[];
string $barc[$i] = {$barpiece};

}

}

at least i think it should work like this, but well, being a newbie... :unsure:
anyway the error i get is:

// Error: _string $barc[$i] = {$barpiece}; //
// Error: Syntax error //

i hope you can help me with this issue.
thanks in advance!

greetings
joh

# 2 06-02-2006 , 06:23 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
use the tokenize command:


string $buffer[];
string $myNumbs = "1 2 3 4 5 6 7 8 9 10";

tokenize $myNumbs " " $buffer;

for($numb in $buffer)
{
print("numb: -->" + $numb +"<--\n");
}

user added image
A


Technical Director - Framestore

Currently working on: Your Highness

IMDB
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads