Folding processing of strings

xiaoxiao2021-03-05  27

Private string insteadofrnstring (String Note, int Maxlen) {

// String Retstr = FixupString (Note);

String Retstr = "";

// int maxlen = 32;

String str1 = "";

String str2 = Note;

String Oldstr = "/ r / n";

String newstr = "
";

While (str2.indexof (ildstr)! = - 1) {

Str1 = str2.substring (0, str2.indexof (ildstr));

IF (str1.length ()> maxlen) {

Str1 = str2.substring (0, Maxlen);

STR2 = str2.substring (maxlen);

} else {

Str2 = str2.substring (str2.indexof (ildstr) OldStr.Length ());

}

Retstr = RETSTR STR1 NEWSTR;

}

IF (str2.length ()> 0 && str2.length () <= maxlen) {

Retstr = RETSTR STR2;

} else if (str2.length ()> maxlen) {

INT i = 0;

StringBuffer Result = new stringbuffer ();

While (Maxlen

Result.Append (str2.substring (0, maxlen);

//Result.Append (str2.substring(i, Math.min (i maxlen, str2.length ())));

Result.Append (newstr);

STR2 = str2.substring (maxlen);

}

IF (str2.length ()> 0) {

Result.Append (str2);

}

Retstr = RetStr New String (result);

}

Return Retstr;

}

转载请注明原文地址:https://www.9cbs.com/read-36086.html

New Post(0)