List of usage examples for java.text DecimalFormatSymbols getPercent
public char getPercent()
From source file:net.sf.morph.transform.converters.TextToNumberConverter.java
/** * Remove any characters that should be ignored when performing the * conversion.//from w w w . j a v a 2s . co m * * @param string * the input string * @param locale * the locale * @return <code>string</code>, with all characters that should be * ignored removed */ private StringBuffer removeIgnoredCharacters(String string, Locale locale) { StringBuffer charactersToParse = new StringBuffer(); DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); for (int i = 0; i < string.length(); i++) { char currentChar = string.charAt(i); if (getWhitespaceHandling() == WHITESPACE_IGNORE && Character.isWhitespace(currentChar)) { continue; } if (getCurrencyHandling() == CURRENCY_IGNORE && Character.getType(currentChar) == Character.CURRENCY_SYMBOL) { continue; } if (getPercentageHandling() == PERCENTAGE_IGNORE) { if (currentChar == symbols.getPercent()) { continue; } } if (getParenthesesHandling() == PARENTHESES_IGNORE) { if (currentChar == LEFT_PARENTHESES || currentChar == RIGHT_PARENTHESES) { continue; } } charactersToParse.append(currentChar); } return charactersToParse; }
From source file:org.sakaiproject.tool.gradebook.ui.GradebookDependentBean.java
/** * Gets a localized percent input symbol based on the locale determined by FacesContext. *///w w w . j a va2s . c om public String getLocalizedPercentInput() { Locale locale = LocaleUtil.getLocale(FacesContext.getCurrentInstance()); DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale); return String.valueOf(dfs.getPercent()); }