Java tutorial
//package com.java2s; public class Main { /** * Returns jid address without resource specifier * */ public static String parseBareJid(final String jid) { if (jid == null) return null; int indx = jid.indexOf('/'); return jid.substring(0, indx < 0 ? jid.length() : indx); } }