index 把@前的截断作为

  /**
     * Returns the name portion of a XMPP address. For example, for the
     * address "[email protected]/Smack", "matt" would be returned. If no
     * username is present in the address, the empty string will be returned.
     *
     *把@前的截断作为
     * @param XMPPAddress the XMPP address.
     * @return the name portion of the XMPP address.
     */
    public static String parseName(String xmppAddress) {
        if (Utils.isStrEmpty(xmppAddress)) {
            return "";
        }
        int atIndex = xmppAddress.lastIndexOf("@");
        if (atIndex <= 0) {
            return xmppAddress;
        }
        else {
            return xmppAddress.substring(0, atIndex);
        }
    }

你可能感兴趣的:(index 把@前的截断作为)