Convert Enum to String

Hello!Somebody knows how can I convert an Enum variable to an String variable?Thanks in advance!Roger.
[130 byte] By [roger.kocka] at [2007-10-3 11:14:49]
# 1
Emun is part of java 1.5 and therefor not supported by J2me
deepspacea at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
OK, thank you very much deepspace.
roger.kocka at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
Now, if you mean the Enumeration object, that can be converted to a string, just check the api docs for a "sort of" example.
deepspacea at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

String name;

StringBuffer buffer;

While(enumer.hasElements())

{

name=enumer.nextElement();

///do with the string what you want or

buffer.append(enumer.nextElement().Tostring());

}

buffer.toString()

that 's will work plz note that in jdk1.5 enum is a keyword

RizwanZahida at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
ooops, yes, I was talking about the Enumeration :-) sorry...where can I find this documentation?Thanks again!
roger.kocka at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6
In your api docs... Api docs are one of the most important things when programming, so always have them near!
deepspacea at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7
Hello RizwanZahid!I will try to use this code and post here the results, thank you very much!Roger.
roger.kocka at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 8
OK, thank you deepspace!
roger.kocka at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 9
Hello again RizwanZahid!Your sugestion worked perfectly, but I've one more rookie question :-) do you know how can I make the inverse proccess... I mean, convert the string variable into an enumeration again?Thank you very much,Roger.
roger.kocka at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 10
Sure: split the strings on some split character, and then put the individual stings in a Vector. A decent spilt function should be out here somewhere, just use the search.
deepspacea at 2007-7-15 13:38:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...