Java Code Examples for org.apache.commons.lang3.text.WordUtils#capitalize()
The following examples show how to use
org.apache.commons.lang3.text.WordUtils#capitalize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CharacterScreen.java From xibalba with MIT License | 6 votes |
private void updateSkillsGroup() { skillsGroup.clear(); skillsGroup.addActor(new Label("Skills", Main.skin)); skillsGroup.addActor(new Label("", Main.skin)); for (Map.Entry<String, Integer> entry : skills.levels.entrySet()) { String skill = entry.getKey(); Integer level = entry.getValue(); if (level > 0) { String name = WordUtils.capitalize(skill); skillsGroup.addActor(new Label( "[LIGHT_GRAY]" + name + " [WHITE]" + level + "[DARK_GRAY]d", Main.skin )); } } }
Example 2
Source File: CharacterScreen.java From xibalba with MIT License | 6 votes |
private void updateEquipmentGroup() { equipmentGroup.clear(); equipmentGroup.addActor(new Label("Equipment", Main.skin)); equipmentGroup.addActor(new Label("", Main.skin)); int index = 0; for (java.util.Map.Entry<String, Entity> slot : equipment.slots.entrySet()) { String key = WordUtils.capitalize(slot.getKey()); Entity item = slot.getValue(); if (!WorldManager.entityHelpers.hasDefect(player, "One arm") || !Objects.equals(slot.getKey(), "left hand")) { equipmentGroup.addActor( new Label(createEquipmentSlotText(index, key, item), Main.skin) ); } index++; } }
Example 3
Source File: OperatorDiscoverer.java From Bats with Apache License 2.0 | 5 votes |
private JSONArray enrichProperties(String operatorClass, JSONArray properties) throws JSONException { JSONArray result = new JSONArray(); for (int i = 0; i < properties.length(); i++) { JSONObject propJ = properties.getJSONObject(i); String propName = WordUtils.capitalize(propJ.getString("name")); String getPrefix = (propJ.getString("type").equals("boolean") || propJ.getString("type").equals("java.lang.Boolean")) ? "is" : "get"; String setPrefix = "set"; OperatorClassInfo oci = getOperatorClassWithGetterSetter(operatorClass, setPrefix + propName, getPrefix + propName); if (oci == null) { result.put(propJ); continue; } MethodInfo setterInfo = oci.setMethods.get(setPrefix + propName); MethodInfo getterInfo = oci.getMethods.get(getPrefix + propName); if ((getterInfo != null && getterInfo.omitFromUI) || (setterInfo != null && setterInfo.omitFromUI)) { continue; } if (setterInfo != null) { addTagsToProperties(setterInfo, propJ); } else if (getterInfo != null) { addTagsToProperties(getterInfo, propJ); } result.put(propJ); } return result; }
Example 4
Source File: TitleFunction.java From jtwig-core with Apache License 2.0 | 5 votes |
@Override public Object execute(FunctionRequest request) { request.minimumNumberOfArguments(1).maximumNumberOfArguments(1); String input = request.getEnvironment().getValueEnvironment() .getStringConverter() .convert(request.get(0)); return WordUtils.capitalize(input); }
Example 5
Source File: NameHelper.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public static String toCamelCase(String name, boolean startWithLowerCase) { char[] wordDelimiters = new char[]{'_', ' ', '-'}; if (containsAny(name, wordDelimiters)) { String capitalizedNodeName = WordUtils.capitalize(name, wordDelimiters); name = name.charAt(0) + capitalizedNodeName.substring(1); for (char c : wordDelimiters) { name = remove(name, c); } } return startWithLowerCase ? StringUtils.uncapitalize(name) : StringUtils.capitalize(name); }
Example 6
Source File: HudRenderer.java From xibalba with MIT License | 5 votes |
private void updateFocused() { if (WorldManager.state == WorldManager.State.FOCUSED) { if (focusedTable.getChildren().size == 0) { BodyComponent body = ComponentMappers.body.get(playerDetails.focusedEntity); int actionNumber = 0; for (String part : body.bodyParts.keySet()) { actionNumber++; // If you look at the docs for Input.Keys, number keys are offset by 7 // (e.g. 0 = 7, 1 = 8, etc) ActionButton button = new ActionButton(actionNumber, WordUtils.capitalize(part)); button.setKeys(actionNumber + 7); button.setAction(bottomTable, () -> handleFocusedAttack(part)); focusedTable.add(button).pad(5, 0, 0, 0); if ((actionNumber & 1) == 0) { focusedTable.row(); } } } } else { if (focusedTable.getChildren().size > 0) { focusedTable.clear(); } } }
Example 7
Source File: YouScreen.java From xibalba with MIT License | 5 votes |
private String createSkillText(int index, String name, int level) { String capitalizedName = WordUtils.capitalize(name); String levelString = level == 0 ? " [WHITE]" + level : " [DARK_GRAY]d[WHITE]" + level; String details = "[DARK_GRAY] " + playerSetup.skills.associations.get(name); if (sectionSelected == Section.SKILLS && index == itemSelected) { return "[DARK_GRAY]> [WHITE]" + capitalizedName + levelString + details; } else { return "[LIGHT_GRAY]" + capitalizedName + levelString + details; } }
Example 8
Source File: Core.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public static String[] capitalizeStringArray(String[] array) { String[] outArray = new String[array.length]; for(int i = 0; i < array.length; i++) { outArray[i] = WordUtils.capitalize(array[i]); } return outArray; }
Example 9
Source File: DateUtils.java From arcusandroid with Apache License 2.0 | 5 votes |
public static String formatSunriseSunset(@NonNull TimeOfDay timeOfDay) { String riseSet = WordUtils.capitalize(timeOfDay.getSunriseSunset().name().toLowerCase()); int offset = timeOfDay.getOffset(); if (offset == 0) { return String.format("At %s", riseSet); } else { boolean before = offset < 0; return String.format("%s Min %s %s", Math.abs(offset), before ? "Before" : "After", riseSet); } }
Example 10
Source File: OperatorDiscoverer.java From attic-apex-core with Apache License 2.0 | 5 votes |
private JSONArray enrichProperties(String operatorClass, JSONArray properties) throws JSONException { JSONArray result = new JSONArray(); for (int i = 0; i < properties.length(); i++) { JSONObject propJ = properties.getJSONObject(i); String propName = WordUtils.capitalize(propJ.getString("name")); String getPrefix = (propJ.getString("type").equals("boolean") || propJ.getString("type").equals("java.lang.Boolean")) ? "is" : "get"; String setPrefix = "set"; OperatorClassInfo oci = getOperatorClassWithGetterSetter(operatorClass, setPrefix + propName, getPrefix + propName); if (oci == null) { result.put(propJ); continue; } MethodInfo setterInfo = oci.setMethods.get(setPrefix + propName); MethodInfo getterInfo = oci.getMethods.get(getPrefix + propName); if ((getterInfo != null && getterInfo.omitFromUI) || (setterInfo != null && setterInfo.omitFromUI)) { continue; } if (setterInfo != null) { addTagsToProperties(setterInfo, propJ); } else if (getterInfo != null) { addTagsToProperties(getterInfo, propJ); } result.put(propJ); } return result; }
Example 11
Source File: Downloads.java From openwebbeans-meecrowave with Apache License 2.0 | 5 votes |
private static Download toDownload(final String artifactId, final String classifier, final String version, final String format, String artifactUrl) { String url = DIST_RELEASE + version + "/" + artifactId + "-" + version + "-" + classifier + "." + format; String downloadUrl; String sha512 = null; if (urlExists(url)) { // artifact exists on dist.a.o downloadUrl = MIRROR_RELEASE + version + "/" + artifactId + "-" + version + "-" + classifier + "." + format; } else { url = ARCHIVE_RELEASE + version + "/" + artifactId + "-" + version + "-" + classifier + "." + format; if (urlExists(url)) { // artifact exists on archive.a.o downloadUrl = url; } else { // falling back to Maven URL downloadUrl = artifactUrl; url = artifactUrl; } } if (urlExists(url + ".sha512")) { sha512 = url + ".sha512"; } return new Download( WordUtils.capitalize(artifactId.replace('-', ' ')), classifier, version, format, downloadUrl, url + ".sha1", sha512, url + ".asc", artifactUrl); }
Example 12
Source File: AptoideUtils.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
public static String parseLocalyticsTag(String str) { return WordUtils.capitalize(str.replace('-', ' ')); }
Example 13
Source File: PDBIO.java From OSPREY3 with GNU General Public License v2.0 | 4 votes |
private static List<Molecule> readMols(Iterable<String> pdbIter) { List<Molecule> mols = new ArrayList<>(); Molecule mol = new Molecule(); mols.add(mol); ResInfo resInfo = new ResInfo(); for (String line : pdbIter) { line = padLine(line); if (isLine(line, "MODEL")) { // is this the first model? if (mol.residues.isEmpty()) { // ignore } else { // advance to the next molecule resInfo.flush(mol); mol = new Molecule(); mols.add(mol); } } else if (isLine(line, "ATOM") || isLine(line, "HETATM")) { // eg // 1 2 3 4 5 6 7 8 // 012345678901234567890123456789012345678901234567890123456789012345678901234567890 // ATOM 1146 CB APRO A 38 5.781 17.860 0.637 0.45 12.10 C // parse the line int atomNum = Integer.parseInt(line.substring(6, 11).trim()); String atomName = line.substring(12,16).trim(); char alt = line.charAt(16); String resName = trimRight(line.substring(17,27)); double x = Double.parseDouble(line.substring(30, 38).trim()); double y = Double.parseDouble(line.substring(38, 46).trim()); double z = Double.parseDouble(line.substring(46, 54).trim()); double bFactor = Double.parseDouble(defaultVal("0", line.substring(60, 66).trim())); // read the element, but enforce proper capitalization so we can match to the names in PeriodicTable String elem = WordUtils.capitalize(line.substring(76, 78).trim().toLowerCase()); // should we start a new residue (with alts)? if (!resName.equals(resInfo.name)) { resInfo.flush(mol); resInfo.name = resName; } // make the atom and check the element Atom atom; if (elem.isEmpty()) { atom = new Atom(atomName); } else { atom = new Atom(atomName, elem); } if (atom.elementType.equalsIgnoreCase("du")) { System.out.println(String.format("WARNING: Can't detect atom element: residue=%s, name=%s, element=%s\n" + "\nPlease include element types in the PDB file to avoid this problem.", resInfo.name, atomName, elem )); } // save the rest of the atom properties atom.BFactor = bFactor; atom.modelAtomNumber = atomNum; // update the res info with the atom resInfo.addAtom(atom, x, y, z, alt); } } resInfo.flush(mol); return mols; }
Example 14
Source File: FilterPanel.java From find with MIT License | 4 votes |
public String formattedNameOfNonZeroField(final int n) { return WordUtils.capitalize(parametricField(nonZeroParamFieldContainer(n)) .filterCategoryName() .toLowerCase()); }
Example 15
Source File: CSV.java From flink with Apache License 2.0 | 4 votes |
@Override public String getIdentity() { return WordUtils.capitalize(getName()) + WordUtils.capitalize(type.getValue()) + " (" + inputFilename + ")"; }
Example 16
Source File: CallHierarchy.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public Object build() { WordUtils.capitalize("a"); WordUtils.capitalize("b"); return null; }
Example 17
Source File: ComputerVisionString.java From cognitivej with Apache License 2.0 | 4 votes |
@NotNull public static String describe(@NotNull ImageDescription imageDescription) { return WordUtils.capitalize(imageDescription.description.captions.get(0).text); }
Example 18
Source File: CSV.java From flink with Apache License 2.0 | 4 votes |
@Override public String getIdentity() { return WordUtils.capitalize(getName()) + WordUtils.capitalize(type.getValue()) + " (" + inputFilename + ")"; }
Example 19
Source File: TitleCaseConverter.java From tutorials with MIT License | 4 votes |
public static String convertToTileCaseWordUtils(String text) { return WordUtils.capitalize(text); }
Example 20
Source File: ItemDetailsActivity.java From WaniKani-for-Android with GNU General Public License v3.0 | 4 votes |
private void showUserSpecific() { /** Check whether burned and display content accordingly */ if (mItem.isBurned()) { mBurned.setVisibility(View.VISIBLE); SimpleDateFormat sdf = new SimpleDateFormat("MMMM d, yyyy"); mBurnedDate.setText(sdf.format(mItem.getBurnedDate())); } /** SRS Level */ if (mItem.getSrsLevel().equals("apprentice")) { mSRSLogo.setImageResource(R.drawable.apprentice); mSRSLevel.setText(R.string.srs_title_apprentice); } if (mItem.getSrsLevel().equals("guru")) { mSRSLogo.setImageResource(R.drawable.guru); mSRSLevel.setText(R.string.srs_title_guru); } if (mItem.getSrsLevel().equals("master")) { mSRSLogo.setImageResource(R.drawable.master); mSRSLevel.setText(R.string.srs_title_master); } if (mItem.getSrsLevel().equals("enlighten")) { mSRSLogo.setImageResource(R.drawable.enlighten); mSRSLevel.setText(R.string.srs_title_enlightened); } if (mItem.getSrsLevel().equals("burned")) { mSRSLogo.setImageResource(R.drawable.burned); mSRSLevel.setText(R.string.srs_title_burned); } /** Unlock date */ SimpleDateFormat unlockDateFormat = new SimpleDateFormat("MMMM d, yyyy"); mUnlocked.setText(unlockDateFormat.format(mItem.getUnlockDate()) + ""); /** Next available */ SimpleDateFormat availableDateFormat = new SimpleDateFormat("dd MMMM HH:mm"); if (PrefManager.isUseSpecificDates()) { mNextAvailable.setText(availableDateFormat.format(mItem.getAvailableDate()) + ""); } else { mNextAvailable.setReferenceTime(mItem.getAvailableDate()); } mNextAvailableHolder.setVisibility(mItem.isBurned() ? View.GONE : View.VISIBLE); /** Meaning */ mMeaningCorrectPercentage.setText(mItem.getMeaningCorrectPercentage() + ""); mMeaningIncorrectPercentage.setText(mItem.getMeaningIncorrectPercentage() + ""); mMeaningCorrectProgressBar.setProgress(mItem.getMeaningCorrectPercentage()); mMeaningIncorrectProgressBar.setProgress(mItem.getMeaningIncorrectPercentage()); mMeaningMaxStreak.setText(mItem.getMeaningMaxStreak() + ""); mMeaningCurrentStreak.setText(mItem.getMeaningCurrentStreak() + ""); /** Reading (For Kanji and Vocabulary) */ if (mItem.getType().equals(BaseItem.ItemType.KANJI) || mItem.getType().equals(BaseItem.ItemType.VOCABULARY)) { mReadingCorrectPercentage.setText(mItem.getReadingCorrectPercentage() + ""); mReadingIncorrectPercentage.setText(mItem.getReadingIncorrectPercentage() + ""); mReadingMaxStreak.setText(mItem.getReadingMaxStreak() + ""); mReadingCurrentStreak.setText(mItem.getReadingCurrentStreak() + ""); mReadingCorrectProgressBar.setProgress(mItem.getReadingCorrectPercentage()); mReadingIncorrectProgressBar.setProgress(mItem.getReadingIncorrectPercentage()); } /** User synonyms */ if (mItem.getUserSynonyms() != null) { String synonyms = WordUtils.capitalize( Arrays.toString(mItem.getUserSynonyms()).replace("[", "").replace("]", "")); mUserSynonyms.setText(synonyms); } else { if (mAlternativeMeaningsHolder.getVisibility() == View.GONE) mAlternativeMeaningsAndUserSynonymsCard.setVisibility(View.GONE); else mUserSynonymsHolder.setVisibility(View.GONE); } /** Reading note */ if (mItem.getReadingNote() != null) mReadingNote.setText(mItem.getReadingNote()); else mReadingNoteCard.setVisibility(View.GONE); /** Meaning note */ if (mItem.getMeaningNote() != null) mMeaningNote.setText(mItem.getMeaningNote()); else mMeaningNoteCard.setVisibility(View.GONE); }