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

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

Go to download

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

There is a newer version: 5.17.0
Show newest version
package io.nosqlbench.virtdata.lang.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