Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

public class Main {
    public static String convertToUnquotedString(String string) {
        if (TextUtils.isEmpty(string))
            return "";

        if (!isQuotedString(string))
            return string;

        return string.substring(1, string.length() - 1);
    }

    public static boolean isQuotedString(String string) {
        if (TextUtils.isEmpty(string))
            return false;

        if (string.length() >= 2 && string.charAt(0) == '"' && string.charAt(string.length() - 1) == '"')
            return true;
        return false;
    }
}