sS agiBlue_urlRewrite_rightToLeft(S s) { int iSlash = indexOfAny(s, "/?"); if (charAt(s, iSlash) != '/') ret s; int iStart = iSlash+1; int iEnd = smartIndexOf(s, iStart, '?'); if (iEnd <= iStart) ret s; ret makeAGIBlueDomain(urldecode(substring(s, iStart, iEnd))); }