Java tutorial
//package com.java2s; public class Main { public static String[] parse(String str) { String[] strs = new String[2]; if (str.contains("|")) { strs[0] = str.substring(0, str.indexOf("|")); strs[1] = str.substring(str.indexOf("|") + 1, str.length()); } else { strs[0] = str; strs[1] = str; } return strs; } }