local lcInside, laBusted, lcReturn >dimension laBusted[1] > >oldval="RGB(0,0,0,255,255,255)" >lcInside = substr(oldVal, at("(",oldVal)+1) >lcInside = left(alltrim(lcInside), len(alltrim(lcInside))-1) > >if alines(laBusted, lcInside, ",") = 6 > lcReturn = "rgb(" + laBusted[4] + "," + laBusted[5] + "," + laBusted[6] + "," + ; > laBusted[1] + "," + laBusted[2] + "," + laBusted[3] + ; > ")" >else > error "invalid source string" >endif >? lcReturn> >Hi Steve, I couldn't resist, here is pretty much the same thing in 3 (executable) lines:
? fSwapRGB( " RGB( 111, 222, 333, 1, 2, 3 ) " ) Function fSwapRGB( cOldValue ) cInside = ChrTran( cOldValue, "RGB() ", "" ) Return "RGB(" ; + SubStr( cInside, At( ",", cInside, 3 ) + 1 ) ; + "," ; + Left( cInside, At( ",", cInside, 3 ) - 1 ) ; + ")"But what do you know Sergey got there years ago! Looks like StrExtract() appeared in version 7, so I guess I can claim backward compatibility with early versions.