本文整理了Java中java.lang.Character.isSpaceChar()
方法的一些代码示例,展示了Character.isSpaceChar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.isSpaceChar()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:isSpaceChar
[英]See #isSpaceChar(int).
[中]请参见#isSpaceChar(int)。
代码示例来源:origin: hankcs/HanLP
private static void loadSpace() {
for (int i = Character.MIN_CODE_POINT; i <= Character.MAX_CODE_POINT; i++) {
if (Character.isWhitespace(i) || Character.isSpaceChar(i)) {
CONVERT[i] = ' ';
}
}
}
代码示例来源:origin: robovm/robovm
/**
* See {@link #isSpaceChar(int)}.
*/
public static boolean isSpaceChar(char c) {
return isSpaceChar((int) c);
}
代码示例来源:origin: jphp-group/jphp
@Override
boolean check(char ch) {
return Character.isSpaceChar(ch);
}
});
代码示例来源:origin: jphp-group/jphp
@Override
boolean check(char ch) {
return Character.isSpaceChar(ch) || isPrintableChar(ch);
}
});
代码示例来源:origin: konsoletyper/teavm
@Override
public boolean contains(int ch) {
return Character.isSpaceChar(ch);
}
};
代码示例来源:origin: robovm/robovm
/**
* Checks whether a character is a whitespace character.
* RFC 2616, section 2.2 defines space and horizontal tab as whitespace.
* The optional preceeding line break is irrelevant, since header
* continuation is handled transparently when parsing messages.
*
* @param ch the character to check
*
* @return <code>true</code> if the character is whitespace,
* <code>false</code> otherwise
*/
protected boolean isWhitespace(char ch) {
// we do not use Character.isWhitspace(ch) here, since that allows
// many control characters which are not whitespace as per RFC 2616
return ((ch == '\t') || Character.isSpaceChar(ch));
}
代码示例来源:origin: looly/hutool
/**
* 是否空白符<br>
* 空白符包括空格、制表符、全角空格和不间断空格<br>
*
* @see Character#isWhitespace(int)
* @see Character#isSpaceChar(int)
* @param c 字符
* @return 是否空白符
* @since 4.0.10
*/
public static boolean isBlankChar(int c) {
return Character.isWhitespace(c) || Character.isSpaceChar(c) || c == '\ufeff' || c == '\u202a';
}
代码示例来源:origin: looly/hutool
/**
* 是否空白符<br>
* 空白符包括空格、制表符、全角空格和不间断空格<br>
*
* @see Character#isWhitespace(int)
* @see Character#isSpaceChar(int)
* @param c 字符
* @return 是否空白符
* @since 4.0.10
*/
public static boolean isBlankChar(int c) {
return Character.isWhitespace(c) || Character.isSpaceChar(c) || c == '\ufeff' || c == '\u202a';
}
代码示例来源:origin: looly/hutool
/**
* 是否空白符<br>
* 空白符包括空格、制表符、全角空格和不间断空格<br>
*
* @see Character#isWhitespace(int)
* @see Character#isSpaceChar(int)
* @param c 字符
* @return 是否空白符
* @since 3.0.6
* @deprecated 请使用{@link CharUtil#isBlankChar(int)}
*/
@Deprecated
public static boolean isBlankChar(int c) {
return Character.isWhitespace(c) || Character.isSpaceChar(c) || c == '\ufeff' || c == '\u202a';
}
代码示例来源:origin: jphp-group/jphp
@Override
boolean check(char ch) {
return !Character.isDigit(ch)
&& !Character.isLetter(ch)
&& !Character.isSpaceChar(ch)
&& isPrintableChar(ch);
}
});
代码示例来源:origin: looly/hutool
/**
* 是否空白符<br>
* 空白符包括空格、制表符、全角空格和不间断空格<br>
*
* @see Character#isWhitespace(int)
* @see Character#isSpaceChar(int)
* @param c 字符
* @return 是否空白符
* @since 3.0.6
* @deprecated 请使用{@link CharUtil#isBlankChar(int)}
*/
@Deprecated
public static boolean isBlankChar(int c) {
return Character.isWhitespace(c) || Character.isSpaceChar(c) || c == '\ufeff' || c == '\u202a';
}
代码示例来源:origin: facebook/facebook-android-sdk
private boolean isAlphanumericWithSpaces(String str) {
for (int i=0; i<str.length(); i++) {
char c = str.charAt(i);
if (!Character.isDigit(c) && !Character.isLetter(c) && !Character.isSpaceChar(c))
return false;
}
return true;
}
}
代码示例来源:origin: robovm/robovm
@Override protected boolean isRetained(char c) {
return UNRESERVED.indexOf(c) != -1
|| PUNCTUATION.indexOf(c) != -1
|| extraLegalCharacters.indexOf(c) != -1
|| (c > 127 && !Character.isSpaceChar(c) && !Character.isISOControl(c));
}
}
代码示例来源:origin: stackoverflow.com
public static String toTitleCase(String input) {
StringBuilder titleCase = new StringBuilder();
boolean nextTitleCase = true;
for (char c : input.toCharArray()) {
if (Character.isSpaceChar(c)) {
nextTitleCase = true;
} else if (nextTitleCase) {
c = Character.toTitleCase(c);
nextTitleCase = false;
}
titleCase.append(c);
}
return titleCase.toString();
}
代码示例来源:origin: remkop/picocli
private static String bashify(CharSequence value) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
if (Character.isLetterOrDigit(c) || c == '_') {
builder.append(c);
} else if (Character.isSpaceChar(c)) {
builder.append('_');
}
}
return builder.toString();
}
代码示例来源:origin: stackoverflow.com
new InputFilter() {
@Override
public CharSequence filter(CharSequence source, int start, int end,
Spanned dest, int dstart, int dend) {
if (source instanceof SpannableStringBuilder) {
SpannableStringBuilder sourceAsSpannableBuilder = (SpannableStringBuilder)source;
for (int i = end - 1; i >= start; i--) {
char currentChar = source.charAt(i);
if (!Character.isLetterOrDigit(currentChar) && !Character.isSpaceChar(currentChar)) {
sourceAsSpannableBuilder.delete(i, i+1);
}
}
return source;
} else {
StringBuilder filteredStringBuilder = new StringBuilder();
for (int i = start; i < end; i++) {
char currentChar = source.charAt(i);
if (Character.isLetterOrDigit(currentChar) || Character.isSpaceChar(currentChar)) {
filteredStringBuilder.append(currentChar);
}
}
return filteredStringBuilder.toString();
}
}
}
代码示例来源:origin: jphp-group/jphp
@FastMethod
@Signature(@Arg("char"))
public static Memory isSpace(Environment env, Memory... args) {
return Character.isSpaceChar(chr(args[0])) ? Memory.TRUE : Memory.FALSE;
}
代码示例来源:origin: ballerina-platform/ballerina-lang
private static int getCompletionCharOffset(Editor editor) {
int startOffset = editor.getCaretModel().getOffset();
Document document = editor.getDocument();
int textLength = document.getTextLength();
CharSequence charsSequence = document.getCharsSequence();
char c;
for (int i = startOffset; i < textLength; i++) {
c = charsSequence.charAt(i);
if (c == ':') {
return i - startOffset;
} else if (!Character.isSpaceChar(c)) {
break;
}
}
return -1;
}
}
代码示例来源:origin: ballerina-platform/ballerina-lang
private static int getCompletionCharOffset(Editor editor) {
int startOffset = editor.getCaretModel().getOffset();
Document document = editor.getDocument();
int textLength = document.getTextLength();
CharSequence charsSequence = document.getCharsSequence();
char c;
for (int i = startOffset; i < textLength; i++) {
c = charsSequence.charAt(i);
if (c == '(') {
return i - startOffset;
} else if (!Character.isSpaceChar(c)) {
break;
}
}
return -1;
}
}
代码示例来源:origin: ballerina-platform/ballerina-lang
private static int getCompletionCharOffset(Editor editor) {
int startOffset = editor.getCaretModel().getOffset();
Document document = editor.getDocument();
int textLength = document.getTextLength();
CharSequence charsSequence = document.getCharsSequence();
char c;
for (int i = startOffset; i < textLength; i++) {
c = charsSequence.charAt(i);
if (c == '(') {
return i - startOffset;
} else if (!Character.isSpaceChar(c)) {
break;
}
}
return -1;
}
}
内容来源于网络,如有侵权,请联系作者删除!