read string only the last four digit

String aa= "adfdvefdf"

IF i only want to get efdf, what method should i use?

[89 byte] By [warapa] at [2007-11-27 11:27:06]
# 1

Take a look at the API for String. What methods look good?

http://java.sun.com/javase/6/docs/api/java/lang/String.html

BigDaddyLoveHandlesa at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 2

> String aa= "adfdvefdf"

>

> IF i only want to get efdf, what method should i use?

Groovy.

s = "adfdvefdf"[-4..-1]

assert s == "efdf"

;o)

yawmarka at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 3

substring..

thanks

warapa at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 4

> substring..

That's the one!

:o)

yawmarka at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 5

> > String aa= "adfdvefdf"

> >

> > IF i only want to get efdf, what method should i

> use?

>

> Groovy.

>

> s = "adfdvefdf"[-4..-1]

> assert s == "efdf"

>

> ;o)

Slow down, you movin' too fast

BigDaddyLoveHandlesa at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 6

> Slow down, you movin' too fast

Pish. Just tryin' to spread the love.

:o)

yawmarka at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 7

> > Slow down, you movin' too fast

>

> Pish. Just tryin' to spread the love.

You gotta make the moment last

BigDaddyLoveHandlesa at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 8

> You gotta make the moment last

Ah, sorry. I was a bit off-track. Let me rephrase...

I'm just kickin' down the cobblestones, looking for fun and feeling, well, you know.

~

yawmarka at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 9

> > String aa= "adfdvefdf"

> >

> > IF i only want to get efdf, what method should i

> use?

>

> Groovy.

>

> s = "adfdvefdf"[-4..-1]

> assert s == "efdf"

>

> ;o)

Sorry to get out of song mode, but that almost looks pythonish...

petes1234a at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 10

hi,

do you want to find the substring (ex: "efdf") or do you want to get last four letters?

jeyrama at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 11

I'm sure the OP has already solved this on his own. No need to provide code and help another one cheat!

floundera at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...
# 12

> I'm sure the OP has already solved this on his own.

> No need to provide code and help another one cheat!

Cheat? It doesn't sound like an assignment to me, but it

would be funny if he handed in a Groovy solution.

BigDaddyLoveHandlesa at 2007-7-29 16:14:20 > top of Java-index,Java Essentials,New To Java...