List of usage examples for java.lang Character toUpperCase
public static int toUpperCase(int codePoint)
From source file:de.topicmapslab.kuria.runtime.table.ColumnBinding.java
/** * {@inheritDoc}/* w ww .j a va2s. c o m*/ */ public String getColumnTitle() { if (columnTitle == null) return Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1); return columnTitle; }
From source file:de.unentscheidbar.validation.builtin.HostNameValidator.java
private static String validLabelChars() { StringBuilder b = new StringBuilder("-"); for (char c = 'a'; c <= 'z'; c++) { b.append(c);//from w w w . j av a 2s . c om b.append(Character.toUpperCase(c)); } for (char c = '0'; c <= '9'; c++) { b.append(c); } return b.toString(); }
From source file:net.sensemaker.snappy.SnappyUtil.java
public static void setBooleanProperty(String property, Object target, boolean value) { Class clazz = target.getClass(); property = Character.toUpperCase(property.charAt(0)) + property.substring(1); Method method = null;/*from ww w . j a va 2s .c om*/ String methodName = "set" + property; try { method = clazz.getMethod(methodName, Boolean.class); } catch (NoSuchMethodException e) { throw new RuntimeException("Method " + methodName + " not found in " + clazz.getName()); } try { method.invoke(target, new Object[] { value }); } catch (Exception e) { throw new RuntimeException("Error setting property " + property + " in " + clazz.getName(), e); } }
From source file:net.sf.jabb.util.stat.TimePeriod.java
/** * Parse strings like '1 hour', '2 days', '3 Years', '12 minute' into TimePeriod. * Short formats like '1H', '2 D', '3y' are also supported. * @param quantityAndUnit the string to be parsed * @return Both quantity and unit/*from w w w . j a v a 2 s .com*/ */ static public TimePeriod from(String quantityAndUnit) { String trimed = quantityAndUnit.trim(); String allExceptLast = trimed.substring(0, trimed.length() - 1); if (StringUtils.isNumericSpace(allExceptLast)) { // short format long quantity = Long.parseLong(allExceptLast.trim()); TimePeriodUnit unit = TimePeriodUnit.from(Character.toUpperCase(trimed.charAt(trimed.length() - 1))); return new TimePeriod(quantity, unit); } else { String[] durationAndUnit = StringUtils.split(trimed); Long duration = Long.valueOf(durationAndUnit[0]); TimePeriodUnit unit = TimePeriodUnit.from(durationAndUnit[1]); return new TimePeriod(duration, unit); } }
From source file:com.rapidminer.gui.actions.ShowHelpTextInBrowserAction.java
@Override public void actionPerformed(ActionEvent e) { OperatorDescription operatorDescription = this.operatorDocViewer.getDisplayedOperator() .getOperatorDescription();/*from w ww .ja v a 2 s . c o m*/ Plugin provider = operatorDescription.getProvider(); String prefix = StringUtils.EMPTY; if (provider != null) { prefix = provider.getPrefix(); prefix = Character.toUpperCase(prefix.charAt(0)) + prefix.substring(1) + DOUBLE_POINT; } String url = WIKI_URL_FOR_OPERATORS + prefix + this.operatorDocViewer.getDisplayedOperatorDescName().replaceAll(" ", "_"); try { RMUrlHandler.browse(java.net.URI.create(url)); } catch (IOException e2) { SwingTools.showSimpleErrorMessage("cannot_open_browser", e2); } }
From source file:com.qmetry.qaf.automation.util.StringUtil.java
/** * Utility method to create variable or method name from string. * @param formStr/*from w w w .ja v a2 s.c o m*/ * @return */ public static String toCamelCaseIdentifier(String formStr) { StringBuffer res = new StringBuffer(); formStr = formStr.replaceAll("\\{(\\d)*(\\s)*\\}", ""); String[] strArr = formStr.split("\\W"); int i = 0; for (String str : strArr) { if (str.trim().length() > 0) { char[] stringArray = str.trim().toCharArray(); if (i == 0) stringArray[0] = Character.toLowerCase(stringArray[0]); else stringArray[0] = Character.toUpperCase(stringArray[0]); str = new String(stringArray); res.append(str); } i++; } return res.toString().trim(); }
From source file:com.willwinder.universalgcodesender.gcode.processors.Translator.java
@Override public List<String> processCommand(String command, GcodeState state) throws GcodeParserException { // If the file is in absolute mode, no translation is needed. if (!state.inAbsoluteMode) { return Collections.singletonList(command); }//from w ww . j a v a 2 s . c om String comment = GcodePreprocessorUtils.parseComment(command); String rawCommand = GcodePreprocessorUtils.removeComment(command); List<String> parts = GcodePreprocessorUtils.splitCommand(rawCommand); StringBuilder sb = new StringBuilder(); double x = offset.getPositionIn(UnitUtils.Units.getUnits(state.units)).x; double y = offset.getPositionIn(UnitUtils.Units.getUnits(state.units)).y; double z = offset.getPositionIn(UnitUtils.Units.getUnits(state.units)).z; for (String part : parts) { switch (Character.toUpperCase(part.charAt(0))) { case 'X': sb.append(shift(part, x)); break; case 'Y': sb.append(shift(part, y)); break; case 'Z': sb.append(shift(part, z)); break; // Grbl doesn't support absolute arcs, but what the hell. case 'I': if (state.inAbsoluteIJKMode) { sb.append(shift(part, x)); break; } // fall through if not in absolute mode... case 'J': if (state.inAbsoluteIJKMode) { sb.append(shift(part, y)); break; } // fall through if not in absolute mode... case 'K': if (state.inAbsoluteIJKMode) { sb.append(shift(part, z)); break; } // fall through if not in absolute mode... default: sb.append(part); } } if (StringUtils.isNotBlank(comment)) { sb.append("(").append(comment).append(")"); } return Collections.singletonList(sb.toString()); }
From source file:de.uni_koblenz.aggrimm.icp.interfaceAgents.bing.BingResultParser.java
/** * @param o a parsed Bing bingResult string parsed to a JSONObject. * @param source from where the results are ("web" or "image"). * @param skip integer of manually skipped values - needed * for {@code isEmpty()}. * * @return {@code BingResultsContainer} with all extracted BingResults and * set {@code resultsTotal} and {@code offset}. * * @throws IllegalArgumentException when {@code source>} is unknown. *//*from w w w .ja va2 s .c o m*/ @Override public BingResultsContainer<IUnfilteredResult> convertToResultContainer(JSONObject o, String source, int skip) { source = Character.toUpperCase(source.charAt(0)) + source.substring(1); o = (JSONObject) o.get("d"); JSONArray unwrappedJSONArray = (JSONArray) o.get("results"); o = (JSONObject) unwrappedJSONArray.get(0); JSONArray a = (JSONArray) o.get(source); BingResultsContainer<IUnfilteredResult> l = new BingResultsContainer<>(); areInformationFlowsAllowed = databaseQueryHelper.doesDefaultRuleAllowInformationFlows(); switch (source) { case "Web": { for (Object resultObject : a) { JSONObject result = (JSONObject) resultObject; l.add(extractBingWebResult(result)); } break; } case "Image": { for (Object resultObject : a) { JSONObject result = (JSONObject) resultObject; l.add(extractBingImageResult(result)); } break; } default: throw new IllegalArgumentException("source parameter was unknown: " + source); } l.setResultsTotal(getIntValue(o, source + "Total")); l.setOffset(getIntValue(o, source + "Offset")); l.setSkip(skip); return l; }
From source file:com.eryansky.common.utils.StringUtils.java
/** * ??//from w ww . j a va 2s . c o m * * @param str * @return ?? * * <pre> * capitalizeFirstLetter(null) = null; * capitalizeFirstLetter("") = ""; * capitalizeFirstLetter("1ab") = "1ab" * capitalizeFirstLetter("a") = "A" * capitalizeFirstLetter("ab") = "Ab" * capitalizeFirstLetter("Abc") = "Abc" * </pre> */ public static String capitalizeFirstLetter(String str) { return (isEmpty(str) || !Character.isLetter(str.charAt(0))) ? str : Character.toUpperCase(str.charAt(0)) + str.substring(1); }
From source file:com.rorrell.zootest.controllers.EnvironmentController.java
@RequestMapping(value = "/environment/save", method = RequestMethod.POST) public String saveEnvironment(@Valid Environment environment, BindingResult result) { if (result.hasErrors()) { return "environmentform"; }// w ww . j a v a2s. c o m //make sure first letter of name is capitalized environment.setName( Character.toUpperCase(environment.getName().charAt(0)) + environment.getName().substring(1)); envRepo.save(environment); return "redirect:/environments"; }