Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Returns the stylename in a style of the form stylename[;key=value] or an
     * empty string if the given style does not contain a stylename.
     * 
     * @param style
     *            String of the form stylename[;key=value].
     * @return Returns the stylename from the given formatted string.
     */
    public static String getStylename(String style) {
        if (style != null) {
            String[] pairs = style.split(";");
            String stylename = pairs[0];

            if (stylename.indexOf("=") < 0) {
                return stylename;
            }
        }

        return "";
    }
}