View Full Version : Error : string[] to string

11 November 2003, 02:04 PM
global proc selectS() {
string $getItem = `ls -sl -l -tl 1`;
string $numbers =`match ("[0-9]+$") $getItem`;
int $digits = `size($numbers)`;
global string $nSelection;
if($numbers != "") {
$nSelection =`substring $getItem 1 (size($getItem)-$digits)`;
string $allObjects[];
int $nCount = 0;
string $cObj = (($nSelection)+$nCount);
while (`objExists $cObj`){
$allObjects[$nCount] = $cObj;
select $allObjects[$nCount];
$nCount = $nCount + 01;

// Error: Cannot convert data of type string[] to type string. //
I cannot see where this error is hiding.
If you got a clue, let me know :D

11 November 2003, 02:35 PM
script > show line numbers

// Error: line 2 //

the problem is your first command `ls` returns an array.

after changing that, I then got an invalid call to `match`

Id keep fixing... but I must tend to the turkey.


12 December 2003, 02:51 PM
to fix your error change:

`match ("[0-9]+$") $getItem`;
`match "[0-9]+$" $getItem`;

but i'm not sure whether your expression will work better then. didn't check that!

The () in match expressions is to enclose searchstrings and attribute any other operant or qualifier after that.
so in order to match all "lineFeed" or "return" chars. you'd do some' like this match "(\n\r)" $searchstring


CGTalk Moderation
01 January 2006, 07:00 PM
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.