2021年3月7日星期日

Java - How would I split a string into multiple lines depending on an input

I am new to Java and want to split a message that a user inputs into multiple lines depending on what has been inputted as the maximum length. How would I go about repeating it? Here is what I have so far:

int rem = m - maxlength;              System.out.println(message.substring(0, message.length() - rem));              System.out.println(message.substring(message.length() - rem));   
https://stackoverflow.com/questions/66524013/java-how-would-i-split-a-string-into-multiple-lines-depending-on-an-input March 08, 2021 at 11:38AM

没有评论:

发表评论