Java String Dequote dequote(String str)

Here you can find the source of dequote(String str)

Description

Remove leading and tailing unescaped quotes; remove escaping from escaped internal quotes.

License

Open Source License

Declaration

static String dequote(String str) 

Method Source Code

//package com.java2s;
/*/*from ww w . j ava 2 s .  c o m*/
 *  Copyright (c) 2017, salesforce.com, inc.
 *  All rights reserved.
 *  Licensed under the BSD 3-Clause license.
 *  For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public class Main {
    /**
     * Remove leading and tailing unescaped quotes; remove escaping from escaped internal quotes.
     */
    static String dequote(String str) {
        str = str.replace("\\\"", "\"");
        if (str.startsWith("\"")) {
            str = str.substring(1);
        }
        if (str.endsWith("\"")) {
            str = str.substring(0, str.length() - 1);
        }
        return str;
    }
}

Related

  1. dequote(String inputString)
  2. deQuote(String quotedString)
  3. deQuote(String s)
  4. dequote(String s)
  5. dequote(String str)
  6. dequote(String str)
  7. dequote(String str, char quote)
  8. dequote(String string)
  9. dequote(String text)