File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes endsWith? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "endsWith?" Watch "endsWith?" New topic


jim gotti
Ranch Hand

Joined: Jul 02, 2002
Posts: 36
i am currently working on a filesystem structure. ive seen some other code that has a method called check the end of a string for a certain character. i looked in the API and java in a nutshell book , but didnt it see it in any classes. Am i missing this? or is this method a user defined one?
if it isnt, it would make things much easier =).
also. what is the correct syntax for the following. this code is to see if a directory actually exists.

i am not sure if i am using ot corectly,but more or less, i read a string into a method that will return the full path if the dir exists. the string is first converted to a vector, so that is why you see the path.size() method there.
one last Q. i have a method that keeps track of where the user goes in the file structure(general tree)called currentDirNode that takes 2 inputs, one of GeneralTree and one of STring.Signature looks like

the ref is a node where the relative path starts from. along with this, i track a string called CurrentDirectory.
now, i have another method called getFullPath that only takes a String as input. This method is supposed to return the full path if the String that is passed in is a relative one. problem is, my currentDirectory info is located in the other can i access that information from my getFullPath method?
i cant just pass the path value over to the other method since that requires to inputs. I hope i explained it well enough so some people can give me some feedback, im literally at a brick wall now for the past 2.5 hours.

Thank you .
John Dale
Ranch Hand

Joined: Feb 22, 2001
Posts: 399
Take another look at the java API documentation for String. There is an endsWith(String) method.
jim gotti
Ranch Hand

Joined: Jul 02, 2002
Posts: 36
guess being up for SO long has me misty eyed with programming pain!
jim gotti
Ranch Hand

Joined: Jul 02, 2002
Posts: 36
is there a way to compare tokens from a StringTokenizer?
something along the lines of
if ( Token.equals("?") {
do this
I agree. Here's the link:
subject: endsWith?
It's not a secret anymore!