want to get an int value for a key

hi ive got a key in the form ofABC123-DEF456awith the ABC and DEF values remaining constant. the a being any lower case letter..i wanna get an int value for this key.... how do i do it?thanks!
[241 byte] By [Korvanicaa] at [2007-11-26 17:56:27]
# 1

> hi

> ive got a key in the form of

> ABC123-DEF456a

>

> with the ABC and DEF values remaining constant.

> the a being any lower case letter..

>

> i wanna get an int value for this key.... how do i do

> it?

>

> thanks!

Do they need to be unique? What will you use the key for? You can use the hash code if it doesn't need to be unique.

Kaj

kajbja at 2007-7-9 5:09:38 > top of Java-index,Java Essentials,New To Java...
# 2
Why do you want an int value for it? What are your requirements? There looks like there's more than 32 bits of information in that string -- what makes you think that you can represent it as an int? What are you trying to do? What is your goal?
DrLaszloJamfa at 2007-7-9 5:09:38 > top of Java-index,Java Essentials,New To Java...
# 3
its for a hash table.i want to seperate the numbers (123,456) from the letters (ABC,DEF)and add them together.would i be able to use sub strings for this? somet likeString RefNo = s.subString(3,5);
Korvanicaa at 2007-7-9 5:09:38 > top of Java-index,Java Essentials,New To Java...
# 4

> ive got a key in the form of ABC123-DEF456a

>

> with the ABC and DEF values remaining constant.

> the a being any lower case letter..

>

> i wanna get an int value for this key.... how do i do it?

Should the integer value be equal to 123456? You should describe

your requirements a bit more clearly.

kind regards,

Jos

JosAHa at 2007-7-9 5:09:38 > top of Java-index,Java Essentials,New To Java...
# 5

> its for a hash table.

> i want to seperate the numbers (123,456) from the

> letters (ABC,DEF)and add them together.

>

> would i be able to use sub strings for this?

> somet like

>

> String RefNo = s.subString(3,5);

So you don't want to get an integer. You want to get a string with only digits? You can use replaceAll in that case.

Kaj

kajbja at 2007-7-9 5:09:38 > top of Java-index,Java Essentials,New To Java...