!752 p { L tok = javaTok(loadSnippet("#1002054")); // googleMe // classes are UPPER case! replaceToken(tok, "string", "String"); // ...while methods are LOWER case. replaceToken(tok, "Split", "split"); replaceToken(tok, "Equals", "equals"); replaceToken(tok, "Add", "add"); replaceToken(tok, "ToLower", "toLowerCase"); // some syntax replaceToken(tok, "in", ":"); replaceToken(tok, "foreach", "for"); // split function takes a string in Java for (int i = 1; i+6 < l(tok); i += 2) if (eq(tok.get(i), "split") && eq(tok.get(i+2), "(") && tok.get(i+4).startsWith("'") && eq(tok.get(i+6), ")")) tok.set(i+4, charToStringLiteral(tok.get(i+4))); jreplace(tok, "new List", "new ArrayList"); jreplace(tok, ".Count", ".size()"); jreplace(tok, "[*]", ".get($2)"); jreplace(tok, "Uri.EscapeDataString", "urlencode"); print(join(tok)); } static S charToStringLiteral(S s) { ret "\"" + s.charAt(1) + "\""; // todo: special cases }