kaivai
03-09-2012, 01:37 AM
I know this is a stretch, but is there anyway that I can tokenize a " character?
if not, is there any way that I can search a string variable for a particular group of characters? I know that within maya I could search:
ls "*_RN*"
to find any node that contains "_RN" ... is there any way that I could do something like this within a string variable? what I am trying to do is pull both the path, and the reference name from the mayaAscii file.
---> In pseudo code I could get around this by:
$path = file -rdi 1 -ns "sphere___Copy" -dr 1 -rfn "sphere___CopyRN" "C:/Users/Will/Documents/maya/projects/default//scenes/sphere - Copy.ma";
//STEP 1//
tokenize $path "RN" $noRN;
(which gives me two arrays: $noRN[0] and $noRN[1] )
($noRN[1] would equal: "C:/Users/Will/Documents/maya/projects/default//scenes/sphere - Copy.ma";"
//STEP 2//
string $pathQuote[] = strip($noRN[1]);
(this separates the first two quotation marks)
//STEP 3//
and then I would need to reassemble everything from path[1] until (size($pathQuote) - 1) into one variable which would contain:
string $pathSColon = "C:/Users/Will/Documents/maya/projects/default//scenes/sphere - Copy.ma";
//STEP 4//
tokenize $pathSColon ";" $finalPath
(this would get rid of the semicolon, and leave me with nothing but the path in quotation marks)
It just feels like a bit much for what I am trying to do... I feel like there has to be an easier way that I am unaware of...
Thank you so much!!
if not, is there any way that I can search a string variable for a particular group of characters? I know that within maya I could search:
ls "*_RN*"
to find any node that contains "_RN" ... is there any way that I could do something like this within a string variable? what I am trying to do is pull both the path, and the reference name from the mayaAscii file.
---> In pseudo code I could get around this by:
$path = file -rdi 1 -ns "sphere___Copy" -dr 1 -rfn "sphere___CopyRN" "C:/Users/Will/Documents/maya/projects/default//scenes/sphere - Copy.ma";
//STEP 1//
tokenize $path "RN" $noRN;
(which gives me two arrays: $noRN[0] and $noRN[1] )
($noRN[1] would equal: "C:/Users/Will/Documents/maya/projects/default//scenes/sphere - Copy.ma";"
//STEP 2//
string $pathQuote[] = strip($noRN[1]);
(this separates the first two quotation marks)
//STEP 3//
and then I would need to reassemble everything from path[1] until (size($pathQuote) - 1) into one variable which would contain:
string $pathSColon = "C:/Users/Will/Documents/maya/projects/default//scenes/sphere - Copy.ma";
//STEP 4//
tokenize $pathSColon ";" $finalPath
(this would get rid of the semicolon, and leave me with nothing but the path in quotation marks)
It just feels like a bit much for what I am trying to do... I feel like there has to be an easier way that I am unaware of...
Thank you so much!!
