Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**
     * This method is used to remove the full domain name from the server broadcast in order to
     * display it properly.
     *
     * @param str the string to extract name from
     * @return the name without domain
     */
    public static String extractServerName(String str) {
        String returnstring = new String();
        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) == '.') {
                break;
            }
            returnstring += str.charAt(i);
        }
        return returnstring;
    }
}