If I were making a program that had a user-inputted string, and then I wanted to extract the first, middle, and last letter of that string and print them out, how could I do that? I know how to get the last with str.substring(str.length() - 1) but how would I do that with the first? Would it be str.substring(str.length() 0)? And I don't even know how to begin trying to get the middle character if you don't know how many characters the user has inputted. Thank you!
↧