我有这个字符串
|John Doe|123|1980-12-13
它是由以下代码创建的。
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(e.getHireDay());
out.println(e.getName() + "|" +
e.getSalary() + "|" +
calendar.get(Calendar.YEAR) + "-" +
(calendar.get(Calendar.MONTH) + 1) + "-" +
calendar.get(Calendar.DAY_OF_MONTH));
如何用竖线|
和减号-
分隔此字符串?
String[] tokens = line.split("\\|");