All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.virtdata.ast.StringArg Maven / Gradle / Ivy

Go to download

Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4

There is a newer version: 2.12.15
Show newest version
package io.virtdata.ast;

public class StringArg implements ArgType {
    private final String rawEscapedText;
    private final String unEscapedText;

    public StringArg(String rawEscapedText) {
        this.rawEscapedText = rawEscapedText;
        this.unEscapedText = unEscape(rawEscapedText);
    }

    private static String unEscape(String value) {
        String innervalue= value.substring(1, value.length() - 1);
        if (value.startsWith("\"")) {
            innervalue = innervalue.replaceAll("\\\\(.)","$1");
        }
        return innervalue;
    }

    public String getRawValue() {
        return rawEscapedText;
    }
    public String getStringValue() {
        return unEscapedText;
    }

    @Override
    public String toString() {
        return "'"+unEscapedText+"'";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy