StringUtils { @Nullable public static String parseQuotedString(String str) { if (str.charAt(0) != '"') { return null; } smaliFlexLexer lexer = new smaliFlexLexer(new StringReader(str)); lexer.setSuppressErrors(true); CommonToken token = (CommonToken)lexer.nextToken(); if (token.getType() != smaliParser.STRING_LITERAL) { return null; } if (token.getStopIndex() != str.length()-1) { return null; } String text = token.getText(); return text.substring(1, text.length()-1); }  @Nullable static String parseQuotedString(String str);  }
@Test public void testStringUtilsBasic() throws Exception { String parsedString = StringUtils.parseQuotedString("\"abcd\""); Assert.assertEquals("abcd", parsedString); }
@Test public void testStringUtilsQuotedChars() throws Exception { String parsedString = StringUtils.parseQuotedString("\"a\\\\b\\nc\\uabcdd\""); Assert.assertEquals("a\\b\nc\uabcdd", parsedString); }