code: public static String unquote(String s)
      {
          if (s==null)
              return null;
          if (s.length()<2)
              return s;
  
          char first=s.charAt(0);
          char last=s.charAt(s.length()-1);
          if (first!=last || (first!='"' && first!='\''))
              return s;
  
          StringBuilder b=new StringBuilder(s.length()-2);
          boolean escape=false;
          for (int i=1;i<s.length()-1;i++)
          {
              char c = s.charAt(i);
  
              if (escape)
              {
                  escape=false;
                  switch (c)
                  {
                      case 'n':
                          b.append('\n');
                          break;
                      case 'r':
                          b.append('\r');
                          break;
                      case 't':
                          b.append('\t');
                          break;
                      case 'f':
                          b.append('\f');
                          break;
                      case 'b':
                          b.append('\b');
                          break;
                      case 'u':
                          b.append((char)(
                                  (convertHexDigit((byte)s.charAt(i++))<<24)+
                                  (convertHexDigit((byte)s.charAt(i++))<<16)+
                                  (convertHexDigit((byte)s.charAt(i++))<<8)+
                                  (convertHexDigit((byte)s.charAt(i++)))
                                  )
                          );
                          break;
                      default:
                          b.append(c);
                  }
              }
              else if (c=='\\')
              {
                  escape=true;
                  continue;
              }
              else
                  b.append(c);
          }
  
          return b.toString();
      }
docs: Unquote a string.
  @param s The string to unquote.
  @return quoted string