@Test public void parseDomainCornerCases() { assertEquals("", parseDomain("/foo@")); assertEquals("", parseDomain("localpart@")); assertEquals("example.org", parseDomain("example.org/foo@")); assertEquals("foo.jxmpp.org", parseDomain("foo.jxmpp.org/resOne@resTwo")); }
public static String parseDomain(String jid) { if (jid == null) return null; int atIndex = jid.indexOf('@'); int slashIndex = jid.indexOf('/'); if (slashIndex >= 0) { if (slashIndex > atIndex) { return jid.substring(atIndex + 1, slashIndex); } else { return jid.substring(0, slashIndex); } } else { return jid.substring(atIndex + 1); } }
XmppStringUtils { public static String parseDomain(String jid) { if (jid == null) return null; int atIndex = jid.indexOf('@'); int slashIndex = jid.indexOf('/'); if (slashIndex >= 0) { if (slashIndex > atIndex) { return jid.substring(atIndex + 1, slashIndex); } else { return jid.substring(0, slashIndex); } } else { return jid.substring(atIndex + 1); } } }
XmppStringUtils { public static String parseDomain(String jid) { if (jid == null) return null; int atIndex = jid.indexOf('@'); int slashIndex = jid.indexOf('/'); if (slashIndex >= 0) { if (slashIndex > atIndex) { return jid.substring(atIndex + 1, slashIndex); } else { return jid.substring(0, slashIndex); } } else { return jid.substring(atIndex + 1); } }  }
XmppStringUtils { public static String parseDomain(String jid) { if (jid == null) return null; int atIndex = jid.indexOf('@'); int slashIndex = jid.indexOf('/'); if (slashIndex >= 0) { if (slashIndex > atIndex) { return jid.substring(atIndex + 1, slashIndex); } else { return jid.substring(0, slashIndex); } } else { return jid.substring(atIndex + 1); } }  static String parseLocalpart(String jid); static String parseDomain(String jid); static String parseResource(String jid); static String parseBareJid(String jid); static boolean isFullJID(String jid); static boolean isBareJid(String jid); static String escapeLocalpart(String localpart); static String unescapeLocalpart(String localpart); static String completeJidFrom(CharSequence localpart, CharSequence domainpart); static String completeJidFrom(String localpart, String domainpart); static String completeJidFrom(CharSequence localpart, CharSequence domainpart, CharSequence resource); static String completeJidFrom(String localpart, String domainpart, String resource); static String generateKey(String element, String namespace); }
XmppStringUtils { public static String parseDomain(String jid) { if (jid == null) return null; int atIndex = jid.indexOf('@'); int slashIndex = jid.indexOf('/'); if (slashIndex >= 0) { if (slashIndex > atIndex) { return jid.substring(atIndex + 1, slashIndex); } else { return jid.substring(0, slashIndex); } } else { return jid.substring(atIndex + 1); } }  static String parseLocalpart(String jid); static String parseDomain(String jid); static String parseResource(String jid); static String parseBareJid(String jid); static boolean isFullJID(String jid); static boolean isBareJid(String jid); static String escapeLocalpart(String localpart); static String unescapeLocalpart(String localpart); static String completeJidFrom(CharSequence localpart, CharSequence domainpart); static String completeJidFrom(String localpart, String domainpart); static String completeJidFrom(CharSequence localpart, CharSequence domainpart, CharSequence resource); static String completeJidFrom(String localpart, String domainpart, String resource); static String generateKey(String element, String namespace);  }