Arduino ST7735 Word Wrap

here is a super basic code example. it pry needs a couple lines added to detect if a word is bigger than the line limit.

String wrap(String s, int limit){

int space = 0;
 int i = 0;
 int line = 0;
 while(i<s.length()){
  
  if(s.substring(i,i+1)==" "){space=i; }
  if(line>limit-1){s=s.substring(0,space)+"~"+s.substring(space+1);line = 0;}
  i++;line++;}
 s.replace("~","\n");
  return s;
  }

it just runs down the string remembering where the spaces are. when your line count goes past the limit it just add a line break at the last space and resets