List of usage examples for java.lang Character isUnicodeIdentifierPart
public static boolean isUnicodeIdentifierPart(int codePoint)
From source file:Main.java
public static void main(String[] args) { char ch1 = '~', ch2 = '1'; boolean b1 = Character.isUnicodeIdentifierPart(ch1); boolean b2 = Character.isUnicodeIdentifierPart(ch2); System.out.println(b1);/*from w w w . ja v a2s. c om*/ System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) { int cp1 = 0x053e; // represents ARMENIAN CAPITAL LETTER CA int cp2 = 0x0040; // represents @ boolean b1 = Character.isUnicodeIdentifierPart(cp1); boolean b2 = Character.isUnicodeIdentifierPart(cp2); System.out.println(b1);/* ww w. j a va 2 s . com*/ System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) throws java.io.IOException { char c = 'a'; System.out.println("Character = " + (int) c); System.out.println("Defined = " + Character.isDefined(c)); System.out.println("Digit = " + Character.isDigit(c)); System.out.println("Ignorable = " + Character.isIdentifierIgnorable(c)); System.out.println("ISO control = " + Character.isISOControl(c)); System.out.println("Java identifier part = " + Character.isJavaIdentifierPart(c)); System.out.println("Java identifier start = " + Character.isJavaIdentifierStart(c)); System.out.println("Letter = " + Character.isLetter(c)); System.out.println("Letter or digit = " + Character.isLetterOrDigit(c)); System.out.println("Lowercase = " + Character.isLowerCase(c)); System.out.println("Space = " + Character.isSpaceChar(c)); System.out.println("Titlecase = " + Character.isTitleCase(c)); System.out.println("Unicode identifier part = " + Character.isUnicodeIdentifierPart(c)); System.out.println("Unicode identifier start = " + Character.isUnicodeIdentifierStart(c)); System.out.println("Uppercase = " + Character.isUpperCase(c)); System.out.println("White space = " + Character.isWhitespace(c)); byte[] types = { Character.COMBINING_SPACING_MARK, Character.CONNECTOR_PUNCTUATION, Character.CONTROL, Character.CURRENCY_SYMBOL, Character.DASH_PUNCTUATION, Character.DECIMAL_DIGIT_NUMBER, Character.ENCLOSING_MARK, Character.END_PUNCTUATION, Character.FORMAT, Character.LETTER_NUMBER, Character.LINE_SEPARATOR, Character.LOWERCASE_LETTER, Character.MATH_SYMBOL, Character.MODIFIER_SYMBOL, Character.NON_SPACING_MARK, Character.OTHER_LETTER, Character.OTHER_NUMBER, Character.OTHER_PUNCTUATION, Character.OTHER_SYMBOL, Character.PARAGRAPH_SEPARATOR, Character.PRIVATE_USE, Character.SPACE_SEPARATOR, Character.START_PUNCTUATION, Character.SURROGATE, Character.TITLECASE_LETTER, Character.UNASSIGNED, Character.UPPERCASE_LETTER }; String[] typeNames = { "Combining spacing mark", "Connector punctuation", "Control", "Currency symbol", "Dash punctuation", "Decimal digit number", "Enclosing mark", "End punctuation", "Format", "Letter number", "Line separator", "Lowercase letter", "Math symbol", "Modifier symbol", "Non spacing mark", "Other letter", "Other number", "Other punctuation", "Other symbol", "Paragraph separator", "Private use", "Space separator", "Start punctuation", "Surrogate", "Titlecase letter", "Unassigned", "Uppercase letter" }; int type = Character.getType(c); for (int i = 0; i < types.length; i++) if (type == types[i]) { System.out.println("Type name = " + typeNames[i]); break; }//from w w w . ja va 2s.c o m System.out.println("Unicode block = " + Character.UnicodeBlock.of(c)); }
From source file:Classify.java
public static void main(String[] args) throws java.io.IOException { char c = '\u0beb'; // Tamil digit. System.out.println("Character = " + (int) c); System.out.println("Defined = " + Character.isDefined(c)); System.out.println("Digit = " + Character.isDigit(c)); System.out.println("Ignorable = " + Character.isIdentifierIgnorable(c)); System.out.println("ISO control = " + Character.isISOControl(c)); System.out.println("Java identifier part = " + Character.isJavaIdentifierPart(c)); System.out.println("Java identifier start = " + Character.isJavaIdentifierStart(c)); System.out.println("Letter = " + Character.isLetter(c)); System.out.println("Letter or digit = " + Character.isLetterOrDigit(c)); System.out.println("Lowercase = " + Character.isLowerCase(c)); System.out.println("Space = " + Character.isSpaceChar(c)); System.out.println("Titlecase = " + Character.isTitleCase(c)); System.out.println("Unicode identifier part = " + Character.isUnicodeIdentifierPart(c)); System.out.println("Unicode identifier start = " + Character.isUnicodeIdentifierStart(c)); System.out.println("Uppercase = " + Character.isUpperCase(c)); System.out.println("White space = " + Character.isWhitespace(c)); byte[] types = { Character.COMBINING_SPACING_MARK, Character.CONNECTOR_PUNCTUATION, Character.CONTROL, Character.CURRENCY_SYMBOL, Character.DASH_PUNCTUATION, Character.DECIMAL_DIGIT_NUMBER, Character.ENCLOSING_MARK, Character.END_PUNCTUATION, Character.FORMAT, Character.LETTER_NUMBER, Character.LINE_SEPARATOR, Character.LOWERCASE_LETTER, Character.MATH_SYMBOL, Character.MODIFIER_SYMBOL, Character.NON_SPACING_MARK, Character.OTHER_LETTER, Character.OTHER_NUMBER, Character.OTHER_PUNCTUATION, Character.OTHER_SYMBOL, Character.PARAGRAPH_SEPARATOR, Character.PRIVATE_USE, Character.SPACE_SEPARATOR, Character.START_PUNCTUATION, Character.SURROGATE, Character.TITLECASE_LETTER, Character.UNASSIGNED, Character.UPPERCASE_LETTER }; String[] typeNames = { "Combining spacing mark", "Connector punctuation", "Control", "Currency symbol", "Dash punctuation", "Decimal digit number", "Enclosing mark", "End punctuation", "Format", "Letter number", "Line separator", "Lowercase letter", "Math symbol", "Modifier symbol", "Non spacing mark", "Other letter", "Other number", "Other punctuation", "Other symbol", "Paragraph separator", "Private use", "Space separator", "Start punctuation", "Surrogate", "Titlecase letter", "Unassigned", "Uppercase letter" }; int type = Character.getType(c); for (int i = 0; i < types.length; i++) if (type == types[i]) { System.out.println("Type name = " + typeNames[i]); break; }/* ww w.j a v a 2s .c o m*/ System.out.println("Unicode block = " + Character.UnicodeBlock.of(c)); }
From source file:ar.com.tadp.xml.rinzo.core.MultipleLinesTextHover.java
private IRegion findWord(IDocument document, int offset) { int start = -2; int end = -1; try {//from ww w . ja v a 2 s . co m int pos = offset; char c; while (pos >= 0) { c = document.getChar(pos); if (!Character.isUnicodeIdentifierPart(c) && c != '-') { break; } --pos; } start = pos; pos = offset; int length = document.getLength(); while (pos < length) { c = document.getChar(pos); if (!Character.isUnicodeIdentifierPart(c) && c != '-') { break; } ++pos; } end = pos; } catch (BadLocationException x) { } if (start >= -1 && end > -1) { if (start == offset && end == offset) { return new Region(offset, 0); } else if (start == offset) { return new Region(start, end - start); } else { return new Region(start + 1, end - start - 1); } } return null; }
From source file:com.sun.socialsite.util.Utilities.java
/** * @param tag//from ww w . j a va2s . c o m * @return */ public static String stripInvalidTagCharacters(String tag) { if (tag == null) throw new NullPointerException(); StringBuffer sb = new StringBuffer(); char[] charArray = tag.toCharArray(); for (int i = 0; i < charArray.length; i++) { char c = charArray[i]; // fast-path exclusions quotes and commas are obvious switch (c) { case 34: // " case 44: // , continue; } if ((33 <= c && c <= 126) || Character.isUnicodeIdentifierPart(c) || Character.isUnicodeIdentifierStart(c)) { sb.append(charArray[i]); } } return sb.toString(); }
From source file:com.google.dart.tools.ui.internal.text.editor.DartHover.java
private IRegion findWord(IDocument document, int offset) { int start = -2; int end = -1; try {/*from w ww . ja va2s . c om*/ int pos = offset; char c; while (pos >= 0) { c = document.getChar(pos); if (!Character.isUnicodeIdentifierPart(c)) { break; } --pos; } start = pos; pos = offset; int length = document.getLength(); while (pos < length) { c = document.getChar(pos); if (!Character.isUnicodeIdentifierPart(c)) { break; } ++pos; } end = pos; } catch (BadLocationException x) { } if (start >= -1 && end > -1) { if (start == offset && end == offset) { return new Region(offset, 0); } else if (start == offset) { return new Region(start, end - start); } else { return new Region(start + 1, end - start - 1); } } return null; }
From source file:org.apache.webdav.lib.methods.PropFindMethod.java
/** * Property names setter.//from w w w . j a v a 2 s . com * The enumeration may contain strings with or without a namespace prefix * but the preferred way is to provide PropertyName objects. * * @param propertyNames List of the property names */ public void setPropertyNames(Enumeration propertyNames) { checkNotUsed(); Vector list = new Vector(); while (propertyNames.hasMoreElements()) { Object item = propertyNames.nextElement(); if (item instanceof PropertyName) { list.add(item); } else if (item instanceof String) { String propertyName = (String) item; int length = propertyName.length(); boolean found = false; int i = 1; while (!found && (i <= length)) { char chr = propertyName.charAt(length - i); if (!Character.isUnicodeIdentifierPart(chr) && chr != '-' && chr != '_' && chr != '.') { found = true; } else { i++; } } if ((i == 1) || (i >= length)) { list.add(new PropertyName("DAV:", propertyName)); } else { String namespace = propertyName.substring(0, length + 1 - i); String localName = propertyName.substring(length + 1 - i); list.add(new PropertyName(namespace, localName)); } } else { // unknown type // ignore } } this.propertyNames = (PropertyName[]) list.toArray(new PropertyName[list.size()]); }
From source file:org.apache.webdav.lib.methods.ReportMethod.java
/** * Property names setter.//from w w w .j a va2 s .c o m * The enumeration may contain strings with or without a namespace prefix * but the preferred way is to provide PropertyName objects. * * @param propertyNames List of the property names */ public void setPropertyNames(Enumeration propertyNames) { checkNotUsed(); Vector list = new Vector(); while (propertyNames.hasMoreElements()) { Object item = propertyNames.nextElement(); if (item instanceof PropertyName) { list.add(item); } else if (item instanceof String) { String propertyName = (String) item; int length = propertyName.length(); boolean found = false; int i = 1; while (!found && (i <= length)) { char chr = propertyName.charAt(length - i); if (!Character.isUnicodeIdentifierPart(chr) && chr != '-' && chr != '_' && chr != '.') { found = true; } else { i++; } } if ((i == 1) || (i >= length)) { list.add(new PropertyName("DAV:", propertyName)); } else { String namespace = propertyName.substring(0, length + 1 - i); String localName = propertyName.substring(length + 1 - i); list.add(new PropertyName(namespace, localName)); } } else { throw new IllegalArgumentException("Invalid object given for property."); } } this.propertyNames = (PropertyName[]) list.toArray(new PropertyName[list.size()]); if (this.type == ALL) this.type = SUB_SET; }
From source file:org.pentaho.di.core.Const.java
/** * Create a valid filename using a name We remove all special characters, spaces, etc. * * @param name//w ww .j a v a 2 s. com * The name to use as a base for the filename * @return a valid filename */ public static final String createFilename(String name) { StringBuffer filename = new StringBuffer(); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (Character.isUnicodeIdentifierPart(c)) { filename.append(c); } else if (Character.isWhitespace(c)) { filename.append('_'); } } return filename.toString().toLowerCase(); }