The String class has a method that will do that.

However your code does not solve your problem. You need to make a plan as recommended in post#2 before you write the code. Writing code BEFORE you...