Parsing table and field names

About parsing table and field names

Programs should use the geoprocessor's ParseTableName and ParseFieldName methods to split the fully qualified names for a dataset or for a column in a table into its components (database, owner, table, and column).
Programs that need to be relational database management system (RDBMS) independent should not assume that '.' is the delimiter used to separate the components of a fully qualified dataset name. ArcGIS applications always use fully qualified names. If your program is being used as the source of a script tool, any feature class name, for example, needs to be parsed if the program needs to determine the name of the feature class without the user and database names.
In the following code example, the program is checking the input feature class for specific user names. The program could use the String split method to split the qualified name, but it would then assume a specific syntax, which may change if another database type is used.
ParseTableName returns a single string with the database name, owner name, and table name separated by commas. ParseFieldName returns the table name and the field name, also separated by commas. A program can then reliably parse the returned string, since these methods always return the same formatted string. A string in Java has a number of native methods for manipulation. In the following code example, the split method is used to create a String array, using the comma as the delimiter.
gp.setEnvironmentValue("workspace", "Database Connections/hemlock.sde");
String result = gp.parseTableName("ESRITYPE.ESRICNTRY94", "");
String[] results = result.split(",");
for (int i = 0; i < results.length; i++){
    String temp = results[i].trim();
    if (!"" .equals(temp)){