Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 06-02-2006, 08:13 AM   #1
Registered User
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!

jpdefkt is offline   Reply With Quote
Old 06-02-2006, 06:23 PM   #2
Alan's Avatar
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts

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");

Technical Director - Framestore

Currently working on: Your Highness

Alan is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.