Java: How to return single char after string
- by newSpringer
I have a file directory which could look like either
C:\projects\lab3\test\test.java
or
C:\projects\assignment3\test\test.java
But the "lab3" or "assignment3" can appear anywhere in the directory, it is not a set directory
What i want is to check to see if the directory either contains "lab" or "assignment" and get the number that follows. In this case "3"
This is what i have so far
if(directory.toLowerCase().contains("lab")){
} else if (directory.toLowerCase().contains("assignment")){
}
but i do not know how to check for the char straight after the word?