r/javahelp • u/l_Syn_l • May 01 '20
Java Problem
Create a method called process that takes in as input a String and returns a String. The method will break the String on the letter ‘e’ and move all letters after the ‘e’ to be the beginning of a new string and any letters before the ‘e’ to be the end of the String. Any String given to the method is guaranteed to have exactly one occurrence of the letter ‘e’. For example: The method would take the String “Bobehi” would return “hiBob”.
Can someone help me with this please. a simple why of doing this would be great. Thanks
2
Upvotes
3
u/TheSecondist May 01 '20 edited May 01 '20
Start off by thinking of the individual steps you can break this task down into and by checking the Java-Doc for the String-class and see what all its functions can do. You will find useful stuff there.
Referring to the other commenters hint, a loop is one way to do it, but not the only one. As already said, the methods provided by String are helpful here and give you at least one other option.