}\r
return arg0;\r
}\r
+\r
+ /**\r
+ Wrap single line long input string to multiple short line string by word\r
+ \r
+ @param arg0 input string\r
+ @return wraped string\r
+ \r
+ **/\r
+ public static String wrapStringByWord(String arg0) {\r
+ int intMaxLength = 40;\r
+ String strReturn = "";\r
+ String strTemp = "";\r
+ boolean isCopied = true;\r
+\r
+ //\r
+ // Convert string to array by " "\r
+ //\r
+ String s[] = arg0.split(" ");\r
+ if (arg0.indexOf(" ") == -1) {\r
+ s[0] = arg0;\r
+ }\r
+\r
+ //\r
+ // Add each string of array one by one\r
+ //\r
+ for (int index = 0; index < s.length; index++) {\r
+ String ss = s[index];\r
+ isCopied = false;\r
+ //\r
+ // The word length > defined line length\r
+ //\r
+ if (ss.length() > intMaxLength) {\r
+ //\r
+ // Finish previous line\r
+ //\r
+ if (!isCopied) {\r
+ strReturn = strReturn + strTemp + DataType.UNIX_LINE_SEPARATOR;\r
+ strTemp = "";\r
+ }\r
+ //\r
+ // Separater to short lines\r
+ //\r
+ while (ss.length() > 0) {\r
+ if (ss.length() > intMaxLength) {\r
+ strReturn = strReturn + s[index].substring(0, intMaxLength - 1) + DataType.UNIX_LINE_SEPARATOR;\r
+ ss = ss.substring(intMaxLength);\r
+ isCopied = true;\r
+ } else {\r
+ strTemp = ss;\r
+ ss = "";\r
+ isCopied = false;\r
+ }\r
+ }\r
+ } else {\r
+ if ((strTemp + " " + ss).length() <= intMaxLength) {\r
+ strTemp = strTemp + " " + ss;\r
+ continue;\r
+ } else {\r
+ strReturn = strReturn + strTemp + DataType.UNIX_LINE_SEPARATOR;\r
+ strTemp = ss + " ";\r
+ isCopied = true;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (!isCopied) {\r
+ strReturn = strReturn + strTemp;\r
+ }\r
+\r
+ return strReturn;\r
+ }\r
}\r