Ways of looking at the first few characters of a string?

If I have a string, but only want to test the first few characters of it, how could I do this?

For instance, if the string was "hello" how could I test that the first 3 characters are "hel"

Obviously I could convert to an array of chars but I think this is a messy solution.

Thanks

[306 byte] By [Unconditionala] at [2007-11-26 12:45:50]
# 1
String's startsWith( String )
mchan0a at 2007-7-7 16:25:12 > top of Java-index,Java Essentials,Java Programming...
# 2
So, you want to know if a String starts with some other String? Maybe the String API can tell you what method to use.
doremifasollatidoa at 2007-7-7 16:25:12 > top of Java-index,Java Essentials,Java Programming...
# 3
Ah thanks, also, what ios the best to 'chop' characters off the end of a string?ie chop the last 3 charcters which would turn "hello" into "he"
Unconditionala at 2007-7-7 16:25:12 > top of Java-index,Java Essentials,Java Programming...
# 4
So, you want to know how to get a substring of a String? Maybe the String API can tell you what method to use.
DrClapa at 2007-7-7 16:25:12 > top of Java-index,Java Essentials,Java Programming...