I have the following function.
static String getFilenameURL(String url) {
String ret = "";
for (int i = url.length() - 1; i >= 0; i--) {
if (url.charAt(i) == '/') {
for (int j = i + 1; url.length() > j; j++) {
ret += url.charAt(j);
}
break;
}
}
return ret;
}
It goes backwards looking for a Forward slash then copies the string from the backslash. But in C you could just put a pointer to the part you want to return instead of copying from bottom up to the String end, is there an equivalent in Java for this?