/**
* 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.
*/
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);
}
}
* 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.
*/
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);
}
}