XYZ.front()
//and
XYZ.back()
// I am unaware of how to detect a character in the midst of a word, like the 'a' in 'rain'
I imagine if making a hangman game these would be used to cause changes to the underscores, if so, how do you implement them. Here are three examples I would appreciate an answer to, so I know how to detect letters within words
EG.1) a person guesses the 's' in 'school' so it displays s__oo_ (he/she already guessed the 'o's)
EG.2) a person guesses the 'e' in 'bridge' so it displays _____e
EG.3) a person guesses the 'i' in 'stair' so it displays ___i_
Just use a for loop to compare the target characters one-by-one with the latest guess. If there is a match, change the underscore in the shown string to the relevant character and set a boolean variable to true to indicate at least one success.
Be careful with upper-case/lower-case alternatives.