Here you can find the source of tokenizeName(String name)
public static String[] tokenizeName(String name)
//package com.java2s; /******************************************************************************* * Copyright ? 2008, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/* www. j a v a 2s. c o m*/ * IBM Corporation - initial API and implementation * *******************************************************************************/ public class Main { public static String[] tokenizeName(String name) { char[] nameChars = name.toCharArray(); char[][] tokens = new char[][] { new char[nameChars.length], new char[nameChars.length], new char[nameChars.length] }; boolean delimiter = false; int token = 0; int index = 0; for (int i = 0; i < nameChars.length; i++) { if (nameChars[i] == '"') { // Open/close delimiter delimiter = !delimiter; tokens[token][index++] = nameChars[i]; continue; } if (nameChars[i] == '.' && delimiter == false) { // Name is qualified, increment token ++token; index = 0; // Safety check for invalid names, ie more than 3 part names if (token > 2) break; continue; } // Save character tokens[token][index++] = nameChars[i]; } String[] result = new String[3]; // one part name means table name // two part name means schema qualified // three part name means database qualified result[2] = new String(tokens[token]).trim();// table result[1] = (token > 0 ? new String(tokens[token - 1]).trim() : null); result[0] = (token > 1 ? new String(tokens[token - 2]).trim() : null); return result; } }