Skip to main content

Conversion methods for java.lang.Character and others

7 replies [Last post]
epesh
Offline
Joined: 2003-06-19

One of the most common things people need to figure out how to do is convert data types. Therefore, I think Mustang needs:

Character.toAsciiValue(char c)
Character.toUnicodeValue(char c)
String.toIntegerValue(String s)
String.toDoubleValue(String s)

It also needs a java.util.Integer class, that has something like this:

byte[] toByteArray(int)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
patrikbeno
Offline
Joined: 2004-10-11

Who are you, man? Any more bright ideas?

toAsciiValue() makes no sense since ASCII is a subset of UNICODE and Java is all Unicode
toUnicodeValue() makes no sense since you already have 'c' in Unicode (depends on where you got it from)
String.toIntegerValue() -> Integer.valueOf(String)
toDoubleValue() -> dtto
toByteArray(int) -> what is it good for?

epesh
Offline
Joined: 2003-06-19

Well, people keep ASKING, so I figure that the methods that are already there aren't sufficient.

patrikbeno
Offline
Joined: 2004-10-11

but why? what do you or they need? can't figure it out...

epesh
Offline
Joined: 2003-06-19

Well, in all seriousness, what they NEED to do is learn the API. I'm trying to make that easy, by splattering the same utility methods all over the API with slightly different names to maybe catch their eyes at least once.

patrikbeno
Offline
Joined: 2004-10-11

[b]splattering[/b] ;-) I might have known.

[i]Well there is one solution. (JOKING) Let's place all the methods epesh and those ASKING people need into java.lang.Object. Epesh wil provide the list of methods, will you?

I will start it:

toAscii()
toASCII()
fromAsciiToAscii()
toNull(Object)
findSuitableClass(String descriptionOfWhatYouNeed)
[/i]

epesh
Offline
Joined: 2003-06-19

Now, findSuitableClass() might be PERFECT... let's implement that!

patrikbeno
Offline
Joined: 2004-10-11

+1 but with voice recognition support only. ;-)

findSuitableClass(MP3 description)