>> Hi, if I do:
>>
[quoted text clipped - 12 lines]
> it works:
> String[] strCop = String.copyValueOf(cop);
Invalid syntax. copyValueOf() does not return an array.
> then
> System.out.print(strCop[0]+" +++ ");
> am sure it will now.
No, it won't, whatever verb you left out. It will result in compiler error.
However, the result of "arbitraryTypeOfObject + someString" is a String, which
is what applies here, so the whole "strCop" dodge is irrelevant.
Even if you did declare "strCop" as a String and used the correct method and
syntax to get its first character, it would be literally the same type of
expression:
char plus String equals String.

Signature
Lew
cyprian - 08 Jun 2007 17:09 GMT
> >> Hi, if I do:
>
[quoted text clipped - 31 lines]
> --
> Lew
i think i was really in a hurry. String[] references String objects in
the array varaible, strCop. so i guessed he should should read in each
reference singly, i asked him to read it as a whole. read singly like
this:
String[] strCop = new String[copy.length];
for (int i=0; i<cop.length; i++){
//do the valueOfCopy here, component by component.
strCopy[i] = String.valueOfCopy(cop[i]);
/....everything should be okay from here
}
my mistake. i just know it'll work. an IDE not within reach though.
it will this time
cyprian - 09 Jun 2007 13:42 GMT
> > >> Hi, if I do:
>
[quoted text clipped - 47 lines]
> my mistake. i just know it'll work. an IDE not within reach though.
> it will this time
got to hide my head in shame. i tried my code above at home...
well, the asker didn't post wrong code then all he just didn't
understsand was the result syso returned. default for char values is
\u0000 which has a code point of -1 and doesn't map to string the same
way return key and tab key do not map to string.
hmphhh...
char[] cop = new char[30];
Character y = new Character('k');
System.out.println(y.getNumericValue('k'));
System.out.println(y.getNumericValue(cop[0])); //unicode maps
from code point zero
System.out.println(y.getNumericValue('\u0000'));
if (y.isDefined(cop[0]))
System.out.println("yes"); //yes
}
//\u0000 is the first unicode character, rather a symbol, like
\u0009 is the
tab character or your '\t'.
Lew - 09 Jun 2007 13:49 GMT
> got to hide my head in shame. i tried my code above at home...
> well, the asker didn't post wrong code then all he just didn't
> understsand was the result syso returned. default for char values is
> \u0000 which has a code point of -1 and doesn't map to string the same
> way return key and tab key do not map to string.
> hmphhh...
Chars don't "map to" Strings, Strings comprise chars.
Unicode '\u0000' is a perfectly valid char, even in a String. Not all display
devices handle it the same way.
Many posters have made that point to the OP.

Signature
Lew