How is it possible to cut out a part of a string in Java? In that case the string is a link.
current state:
https://stackoverflow.com/questions/68779331/use-token-to-push-some-codes-to-github
What it should look like
https://stackoverflow.com/questions/68779331/
I found something like this on Stack Overflow, but it still shows the whole string instead of the split version.
String categoryURL = link;
categoryURL.substring(0, categoryURL.lastIndexOf("/"));