read string only the last four digit
String aa= "adfdvefdf"
IF i only want to get efdf, what method should i use?
String aa= "adfdvefdf"
IF i only want to get efdf, what method should i use?
Take a look at the API for String. What methods look good?
http://java.sun.com/javase/6/docs/api/java/lang/String.html
> String aa= "adfdvefdf"
>
> IF i only want to get efdf, what method should i use?
Groovy.
s = "adfdvefdf"[-4..-1]
assert s == "efdf"
;o)
> > 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
> > Slow down, you movin' too fast
>
> Pish. Just tryin' to spread the love.
You gotta make the moment last
> 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.
~
> > 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...
I'm sure the OP has already solved this on his own. No need to provide code and help another one cheat!
> 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.