Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**
     * from "myFunction(arg1,arg2)", return ["arg1","arg2"]
     */
    public static String[] getAttributes(String tag) {
        String attributes = tag.substring(tag.indexOf('(') + 1, tag.lastIndexOf(')'));
        if (attributes.isEmpty())
            return new String[0];
        return trim(attributes.split(","));
    }

    /**
     * Trim an array of String (each element)
     */
    public static String[] trim(String[] strings) {
        for (int i = 0; i < strings.length; ++i)
            strings[i] = strings[i].trim();
        return strings;
    }
}