public static String trim(String message)
    {
        while (message.startsWith(" ")) {
            message = message.substring(1);
        }
        while (message.endsWith(" ")) {
            message = message.substring(0, message.length() - 1);
        }
        return message;
    }