@Test public void testConvertToAlphaNumeric() { Assert.assertEquals("Search", Util.convertToAlphaNumeric("Search")); Assert.assertEquals("Search", Util.convertToAlphaNumeric("S.earch")); Assert.assertEquals("e", Util.convertToAlphaNumeric("e$%\u00a3#^()")); Assert.assertEquals("e", Util.convertToAlphaNumeric(":\u0205!")); }
public static String convertToAlphaNumeric(String text) { String textNoAccents = Util.noaccents(text); StringBuffer result = new StringBuffer(textNoAccents.length()); char[] testChars = textNoAccents.toCharArray(); for (char testChar : testChars) { if (Character.isLetterOrDigit(testChar) && testChar < 128) { result.append(testChar); } } return result.toString(); }
Util { public static String convertToAlphaNumeric(String text) { String textNoAccents = Util.noaccents(text); StringBuffer result = new StringBuffer(textNoAccents.length()); char[] testChars = textNoAccents.toCharArray(); for (char testChar : testChars) { if (Character.isLetterOrDigit(testChar) && testChar < 128) { result.append(testChar); } } return result.toString(); } }
Util { public static String convertToAlphaNumeric(String text) { String textNoAccents = Util.noaccents(text); StringBuffer result = new StringBuffer(textNoAccents.length()); char[] testChars = textNoAccents.toCharArray(); for (char testChar : testChars) { if (Character.isLetterOrDigit(testChar) && testChar < 128) { result.append(testChar); } } return result.toString(); }  }
Util { public static String convertToAlphaNumeric(String text) { String textNoAccents = Util.noaccents(text); StringBuffer result = new StringBuffer(textNoAccents.length()); char[] testChars = textNoAccents.toCharArray(); for (char testChar : testChars) { if (Character.isLetterOrDigit(testChar) && testChar < 128) { result.append(testChar); } } return result.toString(); }  String substitute(String pattern, String text); boolean match(String pattern, String text); boolean matched(); String substitute(String pattern, String substitution, String text); Perl5Matcher getMatcher(); Perl5Util getP5util(); List<String> getAllMatches(String content, String spattern, int group); List<String> getUniqueMatches(String content, String spattern, int group); static String cleanValue(String value); static String restoreValue(String value); static Hashtable<String, String> keyValueToHashtable(String mapString); static PatternCache getPatterns(); static Map<String, String[]> getObject(XWikiRequest request, String prefix); static Map<String, T> getSubMap(Map<String, T> map, String prefix); static String getWeb(String fullname); Vector<String> split(String pattern, String text); static boolean contains(String name, String list, String sep); static String noaccents(String text); static boolean isAlphaNumeric(String text); static String getName(String name); static String getName(String name, XWikiContext context); static Cookie getCookie(String cookieName, XWikiContext context); static Cookie getCookie(String cookieName, HttpServletRequest request); static String getHTMLExceptionMessage(XWikiException xe, XWikiContext context); static MonitorPlugin getMonitorPlugin(XWikiContext context); org.w3c.dom.Document getDOMForString(String str); org.w3c.dom.Document getDOMDocument(); @Deprecated static String escapeText(String text); @Deprecated static String escapeURL(String url); static String encodeURI(String text, XWikiContext context); static String decodeURI(String text, XWikiContext context); static String convertToAlphaNumeric(String text); static Date getFileLastModificationDate(String path); static boolean isValidXMLElementName(String elementName); static InputStream getResourceAsStream(String resource); static URL getResource(String resource); static String normalizeLanguage(String languageCode); static long getHash(String uid); }
Util { public static String convertToAlphaNumeric(String text) { String textNoAccents = Util.noaccents(text); StringBuffer result = new StringBuffer(textNoAccents.length()); char[] testChars = textNoAccents.toCharArray(); for (char testChar : testChars) { if (Character.isLetterOrDigit(testChar) && testChar < 128) { result.append(testChar); } } return result.toString(); }  String substitute(String pattern, String text); boolean match(String pattern, String text); boolean matched(); String substitute(String pattern, String substitution, String text); Perl5Matcher getMatcher(); Perl5Util getP5util(); List<String> getAllMatches(String content, String spattern, int group); List<String> getUniqueMatches(String content, String spattern, int group); static String cleanValue(String value); static String restoreValue(String value); static Hashtable<String, String> keyValueToHashtable(String mapString); static PatternCache getPatterns(); static Map<String, String[]> getObject(XWikiRequest request, String prefix); static Map<String, T> getSubMap(Map<String, T> map, String prefix); static String getWeb(String fullname); Vector<String> split(String pattern, String text); static boolean contains(String name, String list, String sep); static String noaccents(String text); static boolean isAlphaNumeric(String text); static String getName(String name); static String getName(String name, XWikiContext context); static Cookie getCookie(String cookieName, XWikiContext context); static Cookie getCookie(String cookieName, HttpServletRequest request); static String getHTMLExceptionMessage(XWikiException xe, XWikiContext context); static MonitorPlugin getMonitorPlugin(XWikiContext context); org.w3c.dom.Document getDOMForString(String str); org.w3c.dom.Document getDOMDocument(); @Deprecated static String escapeText(String text); @Deprecated static String escapeURL(String url); static String encodeURI(String text, XWikiContext context); static String decodeURI(String text, XWikiContext context); static String convertToAlphaNumeric(String text); static Date getFileLastModificationDate(String path); static boolean isValidXMLElementName(String elementName); static InputStream getResourceAsStream(String resource); static URL getResource(String resource); static String normalizeLanguage(String languageCode); static long getHash(String uid);  }