List of usage examples for com.liferay.portal.kernel.util Validator isVariableName
public static boolean isVariableName(String variableName)
true if the string is a valid variable name in Java. From source file:com.liferay.tools.sourceformatter.JSPSourceProcessor.java
License:Open Source License
protected String getVariableName(String line) { if (!line.endsWith(";") || line.startsWith("//")) { return null; }//w w w.j av a2s . c o m String variableName = null; int x = line.indexOf(" = "); if (x == -1) { int y = line.lastIndexOf(" "); if (y != -1) { variableName = line.substring(y + 1, line.length() - 1); } } else { line = line.substring(0, x); int y = line.lastIndexOf(" "); if (y != -1) { variableName = line.substring(y + 1); } } if (Validator.isVariableName(variableName)) { return variableName; } return null; }