public static List<String> splitAtLastBlank(String s,int width){
  List<String> chunks=new ArrayList<>();
  String tmp=s;
  while (tmp.length() > 0) {
    int index=findSplitpoint(tmp,width);
    chunks.add(tmp.substring(0,index));
    while (index < tmp.length() && tmp.charAt(index) == ' ') {
      index+=1;
    }
    if (index < tmp.length() && tmp.regionMatches(index,NEWLINE,0,NEWLINE.length())) {
      index+=NEWLINE.length();
    }
    if (index >= tmp.length()) {
      break;
    }
    tmp=tmp.substring(index);
  }
  return chunks;
}

public static List < String > splitAtLastBlank ( String s , int width ) { List < String > chunks = new ArrayList < > ( ) ; String tmp = s ; while ( tmp . length ( ) > 0 ) { int index = findSplitpoint ( tmp , width ) ; chunks . add ( tmp . substring ( 0 , index ) ) ; while ( index < tmp . length ( ) && tmp . charAt ( index ) == ' ' ) { index += 1 ; } if ( index < tmp . length ( ) && tmp . regionMatches ( index , NEWLINE , 0 , NEWLINE . length ( ) ) ) { index += NEWLINE . length ( ) ; } if ( index >= tmp . length ( ) ) { break ; } tmp = tmp . substring ( index ) ; } return chunks ; }
splits the specified string at the last blank before width . if there is no blank before the given width , it is split at the next .
