Java tutorial
//package com.java2s; public class Main { /** * Returns user name from given jid * */ public static String parseBareName(final String jid) { if (jid == null) return null; int indx = jid.indexOf('@'); return jid.substring(0, indx < 0 ? jid.length() : indx); } }