I am taking a String variable from request.
String issueField = request.getParameter("issueno");
This may or may not have a hyphen in the middle. I want to be able to traverse through the String and divide the string when hyphen is seen.
Use String#split:
String[] parts = issueField.split("-");
Then you can use parts[0]
to get the first part, parts[1]
for the second, ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With