Java tutorial
//package com.java2s; public class Main { public static void splitName(String nodeName, String[] name) { int p = nodeName.indexOf(":"); if (p < 0) { name[0] = null; name[1] = nodeName; } else { name[0] = nodeName.substring(0, p); name[1] = nodeName.substring(p + 1); } } }