This is a simple function to reverse string array in mel.
[mel]
global proc string[] bc_ReverseList(string $bcInputList[])
{
string $bcOutputList[];
for($bcItem in $bcInputList)
{
stringArrayInsertAtIndex(0, $bcOutputList, strip($bcItem));
}
return $bcOutputList;
}
[/mel]
The function can be easily called as shown below
[mel]
string $tempStrArray[] = {“red”, “green”, “blue”};
$tempStrArray = bc_ReverseList($tempStrArray);
print $tempStrArray;
// Result: blue green red //
[/mel]