Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String trimStringValue(String value) {
        if (value == null) {
            return null;
        }
        String text = value;
        char initialChar = text.charAt(0);
        if (text.charAt(text.length() - 1) != initialChar) {
            throw new IllegalArgumentException("malformed string literal");
        }
        text = text.substring(1, text.length() - 1);
        if (initialChar == '\'') {
            text = text.replace("''", "'");
        } else if (initialChar == '"') {
            text = text.replace("\"\"", "\"");
        } else {
            throw new UnsupportedOperationException("Not supported yet.");
        }
        return text;
    }
}