List of usage examples for org.apache.commons.lang StringUtils splitByCharacterTypeCamelCase
public static String[] splitByCharacterTypeCamelCase(String str)
Splits a String by Character type as returned by java.lang.Character.getType(char)
.
From source file:com.carteblanche.kwd.driver.KeywordDrivenDriver.java
public static void main(String[] args) { File[] listOfFiles;/*from w w w. j a v a 2 s .c o m*/ File folder = new File(testDirectory + testSuiteName + "/"); String testSuiteName = folder.getName(); testSuiteName = StringUtils .capitalize(StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(testSuiteName), ' ')); listOfFiles = folder.listFiles(); TestNGDriver testNGDriver = new TestNGDriver(); int i = 0; for (File csv : listOfFiles) { KWDTestCase testCase = TestCaseParser.parse(csv, cvsSplitBy); testNGDriver.runTests(testCase, testSuiteName + i, folder.getName()); i++; } }
From source file:com.carteblanche.kwd.parsers.TestCaseParser.java
public static KWDTestCase parse(File csv, String cvsSplitBy) { BufferedReader br = null;/* w ww .j av a2 s . c o m*/ String line = ""; String csvFile = csv.getAbsolutePath(); try { File file = new File(csvFile); String testCaseName = file.getName(); testCaseName = testCaseName.replace(".csv", ""); testCaseName = StringUtils .capitalize(StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(testCaseName), ' ')); br = new BufferedReader(new FileReader(csvFile)); ArrayList<KWDTestMethod> testMethods = new ArrayList<KWDTestMethod>(); while ((line = br.readLine()) != null) { // use comma as separator String[] columns = line.split(cvsSplitBy); if (columns.length < 1) { System.out.println("Every row should have atleast 1 Column"); System.exit(122); } ArrayList<String> parameters = new ArrayList<String>(); for (int i = 1; i < columns.length; i++) { parameters.add(columns[i]); } KWDTestMethod testMethod = new KWDTestMethod(columns[0], parameters); testMethod.setClasssName("com.carteblanche.kwd.tests.Login"); testMethods.add(testMethod); } KWDTestCase testCase = new KWDTestCase(testCaseName, testMethods); return testCase; // return new KWDTestSuite(testSuiteName, testcases); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; }
From source file:hr.fer.zemris.vhdllab.platform.i18n.LocalizationSupport.java
protected final String getMessageCodeFromSimpleClassName() { if (cached == null) { String className = getClass().getSimpleName(); String altered = alterSimpleClassName(className); StringBuilder code = new StringBuilder(altered.length() + 30); String[] split = StringUtils.splitByCharacterTypeCamelCase(altered); for (String part : split) { part = part.toLowerCase(Locale.ENGLISH); code.append(part).append(PART_SEPARATOR); }/*from ww w. j av a2s . c o m*/ if (split.length > 0) { code.deleteCharAt(code.length() - 1); } cached = alterMessageCode(code.toString()); } return cached; }
From source file:com.googlecode.jmxtrans.model.ResultAttribute.java
/** * Get the {@link ResultAttribute} value from the attribute name * //ww w . j a va 2 s .c o m * @param attributeName * <p>The attribute name for the {@link ResultAttribute} allowed values are:</p> * <ul> * <li>typeName</li> * <li>objDomain</li> * <li>className</li> * <li>attributeName</li> * </ul> * @return the {@link ResultAttribute} */ public static ResultAttribute fromAttribute(@Nonnull String attributeName) { String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); }
From source file:com.izforge.izpack.compiler.helper.CompilerHelper.java
/** * Convert a camel-case class name to a separate dashes nanem * * @param name Class name//from www .ja v a 2s . com * @return minuscule separate dashe name */ public StringBuilder convertNameToDashSeparated(String name) { StringBuilder res = new StringBuilder(); for (String part : StringUtils.splitByCharacterTypeCamelCase(name)) { res.append('-'); res.append(part.toLowerCase()); } return res; }
From source file:edu.ucla.cs.scai.linkedspending.index.Utils.java
public static String normalizeWords(String w) { w = w.replaceAll("[^A-Za-z0-9']", " "); //separate camel case words if (!w.contains(" ")) { w = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(w), ' '); }//w ww . java 2 s . c om //collapse multiple spaces w = w.replaceAll("\\s+", " "); //change to lower case w = w.toLowerCase(); return w; }
From source file:com.googlecode.jmxtrans.model.ResultAttributes.java
/** * Get the {@link ResultAttributes} value from the attribute name * * @param attributeName <p>The attribute name for the {@link ResultAttribute} allowed values are:</p> * <ul>//from www .j a va2 s . c o m * <li>typeName</li> * <li>objDomain</li> * <li>className</li> * <li>attributeName</li> * </ul> * @return the {@link ResultAttribute} */ public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); }
From source file:com.dubture.symfony.core.model.Bundle.java
/** * Returns the bundle namespace or null/*ww w.j a va2 s. co m*/ */ public INamespace getNamespace() throws ModelException { if (_namespace != null) return _namespace; String path = getPath().toString(); if (path == null) return super.getNamespace(); String[] parts = StringUtils.splitByCharacterTypeCamelCase(getElementName()); if (parts.length == 0) { return super.getNamespace(); } String first = parts[0]; int index = path.indexOf(first); if (index == -1) return super.getNamespace(); String ns = path.substring(index); String[] namespace = ns.split("/"); _namespace = new SourceNamespace(namespace); return _namespace; }
From source file:com.expressui.core.util.StringUtil.java
/** * Converts camel case to human-readable form, that is spaced-delimited words with each first * letter capitalized.//from w w w.j a va 2s. com * * @param camelCase string in camel case * @return humanized value */ public static String humanizeCamelCase(String camelCase) { String[] camelCaseParts = StringUtils.splitByCharacterTypeCamelCase(camelCase); String joined = StringUtils.join(camelCaseParts, " "); return capitaliseFirstLetter(joined); }
From source file:ch.systemsx.cisd.openbis.generic.server.dataaccess.db.AbstractGenericEntityDAO.java
private String getEntityDescription() { String nameWithoutPE = getEntityClass().getSimpleName().replace("PE", ""); String words[] = StringUtils.splitByCharacterTypeCamelCase(nameWithoutPE); return StringUtils.join(words, " "); }