11
I wonder if there is a Java function that checks whether the string is a relative path or not:
Ex:
String caminho = funcao("\\pasta\\arquivo.xml") // retorna true que é um caminho relativo
String caminho2 = funcao("c:\\pasta\\arquivo.xml") // retorna false não é caminho relativo
Or also if there is already some function that I pass the string it returns me the complete path:
Ex:
String caminho3 = funcao("\\pasta\\arquivo.xml"); // retorno: c:\pasta\arquivo.xml
String caminho4 = funcao("c:\\pasta\\arquivo.xml"); // retorno: c:\pasta\arquivo.xml
Disagreeing with its final note. It seems to say that a function can only be called a function if the language has first-class functions.
– Miguel Angelo
@What I meant was that in Java it is not called a function method. A function, in my opinion, is any procedure that remains in the overall scope, in any namespace or lib, but Java doesn’t have that. But really a language can have functions or procedures without them being first-class.
– utluiz
I don’t really know Java in practice... but I always thought that anything that returns a result would be called a function. Those who do not return from method, and both would be procedures.
– Miguel Angelo
@Miguelangelo See this question in the SOEN: http://stackoverflow.com/questions/155609/what-is-the-difference-between-a-method-and-a-function
– utluiz
I ended up asking a question here at SOPT... but there’s a very interesting material in this SOEN answer. It was wrong to pollute so much this answer... should have asked the question before. You think I should delete the comments?
– Miguel Angelo
@Miguelangelo I don’t think you need to delete, there are no other comments.
– utluiz