src/main/java/org/jivesoftware/smack/util/StringUtils.java
public static String parseName(String XMPPAddress) {
        if (XMPPAddress == null) {
            return null;
        }
        int atIndex = XMPPAddress.lastIndexOf("@");
        if (atIndex <= 0) {
            return "";
        } else {
            return XMPPAddress.substring(0, atIndex);
        }
    }
public static String parseName(String XMPPAddress) {
        if (XMPPAddress == null) {
            return null;
        }
        int atIndex = XMPPAddress.lastIndexOf("@");
        if (atIndex <= 0) {
            return "";
        } else {
            return XMPPAddress.substring(0, atIndex);
        }
    }
Returns the name portion of a XMPP address. For example, for the address
"matt@jivesoftware.com/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.