Skip to content

Commit eb94cbf

Browse files
author
zhourenjian
committed
Fixed bug#1844122 Character toString not implemented
https://sourceforge.net/tracker/index.php?func=detail&aid=1844122&group_id=155436&atid=795800 But lots of APIs are not implemented in Character. Only common used APIs will be implemented.
1 parent 06da123 commit eb94cbf

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

sources/net.sf.j2s.java.core/src/java/lang/Character.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,37 @@ public static int digit(int codePoint, int radix) {
330330
public static char[] toChars(int point) {
331331
return null;
332332
}
333+
334+
/**
335+
* Returns a <code>String</code> object representing this
336+
* <code>Character</code>'s value. The result is a string of
337+
* length 1 whose sole component is the primitive
338+
* <code>char</code> value represented by this
339+
* <code>Character</code> object.
340+
*
341+
* @return a string representation of this object.
342+
*/
343+
public String toString() {
344+
char buf[] = {value};
345+
return String.valueOf(buf);
346+
}
347+
348+
/**
349+
* Returns a <code>String</code> object representing the
350+
* specified <code>char</code>. The result is a string of length
351+
* 1 consisting solely of the specified <code>char</code>.
352+
*
353+
* @param c the <code>char</code> to be converted
354+
* @return the string representation of the specified <code>char</code>
355+
* @since 1.4
356+
*/
357+
public static String toString(char c) {
358+
/**
359+
* @j2sNative
360+
* if (this == Charater) {
361+
* return "[Charater]";
362+
* }
363+
*/ {}
364+
return String.valueOf(c);
365+
}
333366
}

0 commit comments

Comments
 (0)