fixed additional catches block bug
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / util / QuantumUtil.java
1 /*
2  * Created on 24/08/2003
3  *
4  */
5 package com.quantum.util;
6
7 import java.util.StringTokenizer;
8
9 /**
10  * @author panic
11  *
12  */
13 public class QuantumUtil {
14         /**
15          * Gets the first string in a string with the structure XXXX.XXXX
16          * @param qualifiedName
17          * @return The schema name if present, else an empty string ("")
18          */
19         public static String getSchemaName(String qualifiedName) {
20                 StringTokenizer st = new StringTokenizer(qualifiedName, "."); //$NON-NLS-1$
21                 if (st.countTokens() > 1) {
22                         return st.nextToken();
23                 } else 
24                         return "";
25         }
26
27         /**
28          * Gets the second string in a string with the structure XXXX.XXXX
29          * @param qualifiedName
30          * @return The table name if present, else the received parameter
31          */
32         public static String getTableName(String qualifiedName) {
33                 StringTokenizer st = new StringTokenizer(qualifiedName, "."); //$NON-NLS-1$
34                 if (st.countTokens() > 1) {
35                         st.nextToken();
36                         return st.nextToken();
37                 } else 
38                         return qualifiedName;
39         }
40
41         public static String trasposeEscape(String untrans){
42                 String trasposed = StringUtil.substituteString(untrans, "\\n", "\n");
43                 trasposed = StringUtil.substituteString(trasposed, "\\t", "\t");
44                 
45                 return trasposed;
46         }
47 }