So in Java, I know that str.endsWith(suffix) tests if str ends with something. Let's say I have a text with the line "You are old" in it. How would I take the "old" and set it as a variable so I can print it out in the console?
I know I could do:
if(str.endsWith("old")){ 
   String age = "old";
}
But then I'm going to have more options, so then I'd have to do:
if(str.endsWith("option1")){ 
   String age = "option1";
}
if(str.endsWith("option2")){ 
   String age = "option2";
}
...
Is there a more efficient and less verbose way to check the end of strings over writing many, possibly hundreds, of if statements
Format:
    setting: option
    setting2: option2
    setting3: option3 ...
Regardless of what "option" is, I want to set it to a variable.