本文整理了Java中java.lang.Character.toString()
方法的一些代码示例,展示了Character.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.toString()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:toString
[英]Returns a String object representing this Character's value. The result is a string of length 1 whose sole component is the primitive char value represented by this Character object.
[中]返回表示此字符值的字符串对象。结果是一个长度为1的字符串,其唯一组成部分是由该字符对象表示的基本字符值。
代码示例来源:origin: netty/netty
/**
* Helper method called by {@link #toString()} in order to convert a single map key into a string.
* This is protected to allow subclasses to override the appearance of a given key.
*/
protected String keyToString(char key) {
return Character.toString(key);
}
代码示例来源:origin: libgdx/libgdx
public String toString () {
return Character.toString((char)id);
}
}
代码示例来源:origin: libgdx/libgdx
public String toString () {
return Character.toString((char)id);
}
}
代码示例来源:origin: redisson/redisson
/**
* Helper method called by {@link #toString()} in order to convert a single map key into a string.
* This is protected to allow subclasses to override the appearance of a given key.
*/
protected String keyToString(char key) {
return Character.toString(key);
}
代码示例来源:origin: redisson/redisson
@Override
public String toSourceString(char value) {
return Character.toString(value);
}
代码示例来源:origin: apache/incubator-druid
@JsonProperty
public String getEscape()
{
return escapeChar != null ? escapeChar.toString() : null;
}
代码示例来源:origin: stackoverflow.com
1. String stringValueOf = String.valueOf('c'); // most efficient
2. String stringValueOfCharArray = String.valueOf(new char[]{x});
3. String characterToString = Character.toString('c');
4. String characterObjectToString = new Character('c').toString();
// Although this method seems very simple,
// this is less efficient because the concatenation
// expands to new StringBuilder().append(x).append("").toString();
5. String concatBlankString = 'c' + "";
6. String fromCharArray = new String(new char[]{x});
代码示例来源:origin: spring-projects/spring-framework
public void arrayc(char... vargs) {
s = "";
if (vargs != null) {
s = "";
for (char v: vargs) {
this.s += Character.toString(v);
}
}
}
代码示例来源:origin: libgdx/libgdx
protected String entity (String name) {
if (name.equals("lt")) return "<";
if (name.equals("gt")) return ">";
if (name.equals("amp")) return "&";
if (name.equals("apos")) return "'";
if (name.equals("quot")) return "\"";
if (name.startsWith("#x")) return Character.toString((char)Integer.parseInt(name.substring(2), 16));
return null;
}
代码示例来源:origin: libgdx/libgdx
protected String entity (String name) {
if (name.equals("lt")) return "<";
if (name.equals("gt")) return ">";
if (name.equals("amp")) return "&";
if (name.equals("apos")) return "'";
if (name.equals("quot")) return "\"";
if (name.startsWith("#x")) return Character.toString((char)Integer.parseInt(name.substring(2), 16));
return null;
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void encode(Object obj, JSONWriter jb) throws IOException {
jb.valueString(Character.toString((Character) obj));
}
};
代码示例来源:origin: apache/incubator-dubbo
@Override
public void encode(Object obj, JSONWriter jb) throws IOException {
jb.valueString(Character.toString((Character) obj));
}
};
代码示例来源:origin: redisson/redisson
/**
* Obtains the string representation of this object.
*/
public String toString() {
return Character.toString(getValue());
}
代码示例来源:origin: redisson/redisson
/**
* Returns the string representation.
*/
public String toString() {
return Descriptor.toClassName(Character.toString(descriptor));
}
代码示例来源:origin: neo4j/neo4j
@Override
public void writeString( char value )
{
writeString( Character.toString( value ) );
}
代码示例来源:origin: apache/flink
/**
* Adds a character under the given key.
*/
public void putCharacter(String key, char c) {
checkNotNull(key);
put(key, Character.toString(c));
}
代码示例来源:origin: alibaba/fastjson
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
SerializeWriter out = serializer.out;
Character value = (Character) object;
if (value == null) {
out.writeString("");
return;
}
char c = value.charValue();
if (c == 0) {
out.writeString("\u0000");
} else {
out.writeString(value.toString());
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testHeaderNameValidation() {
for (char c : "\0\t\n\u000B\f\r ,:;=\u0080".toCharArray()) {
try {
HttpUtils.validateHeaderName(Character.toString(c));
fail("Char 0x" + Integer.toHexString(c) + " should not be valid");
} catch (IllegalArgumentException ignore) {
// Ok
}
}
}
代码示例来源:origin: libgdx/libgdx
public void actionPerformed (ActionEvent evt) {
StringBuilder buffer = new StringBuilder();
buffer.append(NEHE_CHARS);
buffer.append('\n');
int count = 0;
for (int i = 33; i <= 255; i++) {
if (buffer.indexOf(Character.toString((char)i)) != -1) continue;
buffer.append((char)i);
if (++count % 30 == 0) buffer.append('\n');
}
sampleTextPane.setText(buffer.toString());
resetCacheButton.doClick();
}
});
代码示例来源:origin: libgdx/libgdx
public void actionPerformed (ActionEvent evt) {
StringBuilder buffer = new StringBuilder();
buffer.append(NEHE_CHARS);
buffer.append('\n');
int count = 0;
for (int i = 33; i <= 255; i++) {
if (buffer.indexOf(Character.toString((char)i)) != -1) continue;
buffer.append((char)i);
if (++count % 30 == 0) buffer.append('\n');
}
sampleTextPane.setText(buffer.toString());
resetCacheButton.doClick();
}
});
内容来源于网络,如有侵权,请联系作者删除!