How to sort and cut String in Java
Hello there! I am developing a software that takes the content of a text file and draws the text onto the screen with automatically generated colored ovals behind groups of text to increase reading speed. I have a separate class called "cutter()" and behaves as follows: The method takes in a string (the contents of the text file) and returns an ArrayList of type String. The algorithm within should be able to locate when to end the line after finding the last space before hitting the character limit. For example: private ArrayList cutter(String fileContent) { Variables: character limit per line (the amount of characters a single line of drawn string can have up to), the arraylist this method returns, and the localized public instance String scanned in another method. Algorithm pseudo: Scan through the text and locate the last space (" ") before hitting the character limit. Once finding this segment, deleting the last space and adding it to the ArrayList. Continuing until the entire String has been snipped. } Algorithms and substrings have always been my weakness. If you can offer any insight regarding my obstacle here, that would be greatly appreciated. Thank you for your consideration!