Java String Extract extractTableName(String line)

Here you can find the source of extractTableName(String line)

Description

extract Table Name

License

Apache License

Declaration

protected static String extractTableName(String line) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    protected static String extractTableName(String line) {
        List<Integer> indices = getQuotePositions(line);
        if (indices.size() < 4) {
            return "";
        }/* w w  w  .ja  v a  2s .co m*/

        return line.substring(indices.get(0), indices.get(3) + 1);
    }

    protected static List<Integer> getQuotePositions(String line) {
        List<Integer> indices = new ArrayList<>();

        char[] chars = line.toCharArray();

        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == '"') {
                indices.add(i);
            }
        }

        return indices;
    }
}

Related

  1. extractParamsFromUriTemplateFragment(String value)
  2. extractReferences(String value)
  3. extractStreetName(String address)
  4. extractStrings(String s)
  5. extractStringsAroundDots(String s)
  6. extractTags(Map layoutProperties)
  7. extractUmiPositions(String pattern)
  8. extractWords(String s)