> I have problem to solve
> where the value is ending with c or f
[quoted text clipped - 11 lines]
> sorry this seems to be extremely BASIC question
> but i need to do ASAP
String value = ......;
char last = value.chatAt(value.length()-1);
or
String last = value.substring(value.length()-1);
just check the Javadoc of java.lang.String for all other methods.
> I have problem to solve
> where the value is ending with c or f
[quoted text clipped - 8 lines]
>
> How to use it.
To start with:
char c = String.getCharAt(String.length-1);
if (c == 'c'){
//equation 1
}
else{
if(c == 'f'){
//equation 2
}
else{
//and now for something completely different
}
}
Then you need to find a way to remove the letter and convert the numbet
to an int/long/float/double, whichever best suits your needs.
See StringBuffer.deleteCharAt(int index), String.substring(int begin,
int end), Integer.parseInt(String), Long.parseLong(String),
Double.parseDouble(String), for example.
THe definitions for these are easy to find at <http://java.sun.com> or
the documentation delivered with the JDK. (These will doubtlessly answer
many of your future questions as well.)

Signature
-Aki "Sus" Laukkanen
Thomas G. Marshall - 21 Jun 2005 00:48 GMT
Aki Laukkanen coughed up:
>> I have problem to solve
>> where the value is ending with c or f
[quoted text clipped - 12 lines]
>
> char c = String.getCharAt(String.length-1);
WHAT!?
> if (c == 'c'){
> //equation 1
[quoted text clipped - 17 lines]
> the documentation delivered with the JDK. (These will doubtlessly
> answer many of your future questions as well.)

Signature
"Well, ain't this place a geographical oddity!
Two weeks from everywhere!"
redgambit - 21 Jun 2005 19:23 GMT
You could use the endsWith() method of a string in a if statment.
if (String.endsWith(f)) {
whatever
}
if (String.endsWith(c)){
whatever
}