Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static final String DOT = ".";
    public static final String FUNC_DELIMS = "()";

    /**
     * Parse func ref from server
     * @param ref form FUNC(Table.Col)
     * @return String[] {Table, Col, FUNC}
     */
    public static String[] getFuncTableColRef(String ref) throws IllegalArgumentException {
        String[] res = null;
        String regex = "[" + FUNC_DELIMS + "\\" + DOT + "]";
        res = ref.split(regex);
        if (res.length != 3)
            throw new IllegalArgumentException("Wrong ref " + ref);
        String[] temp = new String[3];
        temp[0] = res[1];
        temp[1] = res[2];
        temp[2] = res[0];
        return temp;
    }
}