2 * put your module comment here
14 * Statische Hilfsmethoden zur Stringbehandlung
19 public final class StringUtil {
22 * Wandelt Datum in einen 8-ziffrigen String um (yyyymmdd)
24 * @return 8-ziffriger String (yyyymmdd)
27 public static final String date2webdbDate (GregorianCalendar theDate) {
28 StringBuffer webdbDate = new StringBuffer();
29 webdbDate.append(String.valueOf(theDate.get(Calendar.YEAR)));
30 webdbDate.append(pad2(theDate.get(Calendar.MONTH) + 1));
31 webdbDate.append(pad2(theDate.get(Calendar.DATE)));
32 return webdbDate.toString();
36 * wandelt Calendar in dd.mm.yyyy / hh.mm um
38 * @return String mit (dd.mm.yyyy / hh.mm um)
40 public static String date2readableDateTime (GregorianCalendar theDate) {
43 readable += pad2(theDate.get(Calendar.DATE));
44 readable += "." + pad2(theDate.get(Calendar.MONTH) + 1);
45 readable += "." + String.valueOf(theDate.get(Calendar.YEAR));
46 hour = theDate.get(Calendar.HOUR);
47 if (theDate.get(Calendar.AM_PM) == Calendar.PM)
49 readable += " / " + pad2(hour);
50 readable += ":" + pad2(theDate.get(Calendar.MINUTE));
55 * wandelt eine Datum in einen 8-buchstabigen String, der durch <code>/</code>
59 * @return String mit <code>/yyyy/mm/dd</code>
61 public static final String webdbDate2path (String webdbDate) {
62 StringBuffer path = new StringBuffer();
63 path.append("/").append(webdbDate.substring(0, 4));
64 path.append("/").append(webdbDate.substring(4, 6));
67 //path.append("/").append(webdbDate.substring(6, 8));
68 return path.toString();
72 * wandelt Calendar in dd.mm.yyyy um
75 * @return String mit <code>dd.mm.yyyy</code>
77 public static final String webdbDate2readableDate (String webdbDate) {
79 date += webdbDate.substring(6, 8);
80 date += "." + webdbDate.substring(4, 6);
81 date += "." + webdbDate.substring(0, 4);
87 * converts string from format: yyyy-mm-dd__hh:mm:ss.d
90 public static String dateToReadableDate(String date) {
91 StringBuffer returnDate = new StringBuffer();
94 returnDate.append(date.substring(8,10)).append('.');
95 returnDate.append(date.substring(5,7)).append('.');
96 returnDate.append(date.substring(0,4)).append(' ');
97 returnDate.append(date.substring(11,16));
99 return returnDate.toString();
104 * schließt einen String in Anführungsszeichen ein, falls er Leerzeichen o.ä. enthält
106 * @return gequoteter String
108 public static String quoteIfNecessary(String s) {
109 for (int i = 0; i < s.length(); i++)
110 if (!(Character.isLetterOrDigit(s.charAt(i)) || s.charAt(i) == '.'))
111 return quote(s, '"');
116 * schließt <code>s</code> in <code>'</code> ein und setzt Backslashes vor
117 * "gefährliche" Zeichen innerhalb des Strings
118 * Quotes special SQL-characters in <code>s</code>
120 * @return geqoteter String
122 public static String quote(String s)
124 //String s2 = quote(s, '\'');
127 //Because of '?-Bug in Postgresql-JDBC-Driver
128 StringBuffer temp = new StringBuffer();
129 for(int i=0;i<s.length();i++){
130 if(s.charAt(i)=='\''){
131 temp.append("´");
133 temp.append(s.charAt(i));
136 String s2 = temp.toString();
139 s2 = quote(s2, '\"');
144 * schließt <code>s</code> in <code>'</code> ein und setzt Backslashes vor
145 * "gefährliche" Zeichen innerhalb des Strings
147 * @param s String, der gequoted werden soll
148 * @param quoteChar zu quotendes Zeichen
149 * @return gequoteter String
151 public static String quote(String s, char quoteChar)
153 StringBuffer buf = new StringBuffer(s.length());
155 while (pos < s.length()) {
156 int i = s.indexOf(quoteChar, pos);
157 if (i < 0) i = s.length();
158 buf.append(s.substring(pos, i));
160 if (pos < s.length()) {
162 buf.append(quoteChar);
166 return buf.toString();
170 * ersetzt gefährliche zeichen in <code>s</code>
174 public static String unquote(String s)
177 StringBuffer buf = new StringBuffer(s.length());
179 String searchString = "\\"+quoteChar;
180 while (pos < s.length()) {
181 int i = s.indexOf(searchString, pos);
182 if (i < 0) i = s.length();
183 buf.append(s.substring(pos, i));
186 return buf.toString();
190 * Wandelet String in byte[] um.
192 * @return byte[] des String
195 public static byte[] stringToBytes(String s) {
196 String crlf = System.getProperty("line.separator");
197 if (!crlf.equals("\n"))
198 s = replace(s, "\n", crlf);
199 // byte[] buf = new byte[s.length()];
200 byte[] buf = s.getBytes();
205 * Ersetzt in String <code>s</code> das <code>pattern</code> durch <code>substitute</code>
209 * @return String mit den Ersetzungen
211 public static String replace(String s, String pattern, String substitute) {
212 int i = 0, pLen = pattern.length(), sLen = substitute.length();
213 StringBuffer buf = new StringBuffer(s.length());
215 int j = s.indexOf(pattern, i);
217 buf.append(s.substring(i));
220 buf.append(s.substring(i, j));
221 buf.append(substitute);
225 return buf.toString();
230 * Fügt einen Separator an den Pfad an
232 * @return Pfad mit Separator am Ende
234 public static final String addSeparator (String path) {
235 return path.length() == 0 || path.endsWith(File.separator) ? path : path
236 + File.separatorChar;
240 * Fügt ein <code>/</code> ans ende des Strings and
242 * @return Pfad mit <code>/</code> am Ende
244 public static final String addSlash (String path) {
245 return path.length() == 0 || path.endsWith("/") ? path : path + '/';
249 * Löscht <code>/</code> am Ende des Strings, falls vorhanden
251 * @return String ohne <code>/</code> am Ende
253 public static final String removeSlash (String path) {
254 return path.length() > 1 && path.endsWith("/") ? path.substring(0, path.length()
259 * Löscht Slash am Anfang des Strings
263 public static String removeFirstSlash (String path) {
264 return path.startsWith("/") ? path.substring(1) : path;
268 * formatiert eine Zahl (0-99) zweistellig (z.B. 5 -> 05)
269 * @return zwistellige Zahl
271 public static String pad2 (int number) {
272 return number < 10 ? "0" + number : String.valueOf(number);
276 * formatiert eine Zahl (0-999) dreistellig (z.B. 7 -> 007)
278 * @return 3-stellige Zahl
280 public static String pad3 (int number) {
281 return number < 10 ? "00" + number : number < 100 ? "0" + number : String.valueOf(number);
285 * Konvertiert Unix-Linefeeds in Win-Linefeeds
287 * @return Konvertierter String
289 public static String unixLineFeedsToWin(String s) {
292 i = s.indexOf('\n', i+1);
294 if ((i == 0 || s.charAt(i-1) != '\r') &&
295 (i == s.length()-1 || s.charAt(i+1) != '\r')) {
296 s = s.substring(0, i)+'\r'+s.substring(i);
305 * verwandelt einen String in eine gültige Url, konvertiert Sonderzeichen
306 * und Spaces werden zu Underscores
308 * @return gültige Url
310 public static String convert2url(String s) {
312 StringBuffer buf = new StringBuffer();
313 for(int i = 0; i < s.length(); i++ ) {
314 switch( s.charAt( i ) ) {
316 buf.append( "oe" ); break;
318 buf.append( "ae" ); break;
320 buf.append( "ue" ); break;
322 buf.append( "a" ); break;
325 buf.append( "_" ); break;
327 if( buf.charAt( buf.length() - 1 ) != '_' ) {
332 buf.append( s.charAt( i ) );
335 return buf.toString();
339 * wandelt Sonderzeichen in Quotes um
341 * @return Kovertierter String
343 public static String encodeHtml(String s) {
344 StringBuffer buf = new StringBuffer();
345 for(int i=0;i < s.length(); i++ ) {
347 /** @todo looks inefficient */
348 if (s.charAt(i)=='&') {
349 // convert html to xml-parsable representation
350 if( s.indexOf( "ö", i ) == i ) {
351 buf.append( "ö" ); i += 5;
354 if( s.indexOf( "ä", i ) == i ) {
355 buf.append( "ä" ); i += 5;
358 if( s.indexOf( "ü", i ) == i ) {
359 buf.append( "ü" ); i += 5;
362 if( s.indexOf( "Ö", i ) == i ) {
363 buf.append( "Ö" ); i += 5;
366 if( s.indexOf( "Ä", i ) == i ) {
367 buf.append( "Ä" ); i += 5;
370 if( s.indexOf( "Ü", i ) == i ) {
371 buf.append( "Ü" ); i += 5;
374 if( s.indexOf( "ß", i ) == i ) {
375 buf.append( "ß" ); i += 6;
379 /** @todo should only escape outside of tags */
381 if( s.indexOf( """, i ) == i ) {
382 buf.append( "ß" ); i += 5;
385 if( s.indexOf( "–", i ) == i ) {
386 buf.append( "–" ); i += 6;
389 if( s.indexOf( "—", i ) == i ) {
390 buf.append( "—" ); i += 6;
393 if( s.indexOf( "“", i ) == i ) {
394 buf.append( "“" ); i += 6;
397 if( s.indexOf( "”", i ) == i ) {
398 buf.append( "”" ); i += 6;
401 if( s.indexOf( "„", i ) == i ) {
402 buf.append( "„" ); i += 6;
406 //looks pretty stupid
407 if( s.indexOf( "<", i ) == i ) {
408 buf.append( "<" ); i += 3;
411 if( s.indexOf( ">", i ) == i ) {
412 buf.append( ">" ); i += 3;
415 if( s.indexOf( "´", i ) == i ) {
416 buf.append( "´" ); i += 6;
419 if( s.indexOf( " ", i ) == i ) {
420 buf.append( " " ); i += 5;
424 if( s.indexOf( "&", i ) == i ) {
425 buf.append( "&" ); i += 0;
429 // convert umlauts an other special charakters
430 switch( s.charAt(i) ) {
431 case 'ö': buf.append( "ö" ); break;
432 case 'ä': buf.append( "ä" ); break;
433 case 'ü': buf.append( "ü" ); break;
434 case 'Ö': buf.append( "Ö" ); break;
435 case 'Ä': buf.append( "Ä" ); break;
436 case 'Ü': buf.append( "Ü" ); break;
437 case 'ß': buf.append( "ß" ); break;
438 case 'é': buf.append( "é" ); break;
439 case 'è': buf.append( "è" ); break;
440 case 'á': buf.append( "á" ); break;
441 case 'à': buf.append( "à" ); break;
442 case 'â': buf.append( "â" ); break;
443 case 'ã': buf.append( "ã" ); break;
444 case '¬': buf.append( "¬" ); break;
445 case '¹': buf.append( "¹" ); break;
446 case '²': buf.append( "²" ); break;
447 case '³': buf.append( "³" ); break;
448 case '¼': buf.append( "¼" ); break;
449 case '½': buf.append( "½" ); break;
450 case '¾': buf.append( "¾" ); break;
451 case '¶': buf.append( "¶" ); break;
452 case 'æ': buf.append( "æ" ); break;
453 case 'ð': buf.append( "ð" ); break;
454 case '|': buf.append( "¦" ); break;
455 case '·': buf.append( "·" ); break;
456 case '°': buf.append( "°" ); break;
457 case '§': buf.append( "§" ); break;
458 case 'ø': buf.append( "ø" ); break;
459 case 'ç': buf.append( "ç" ); break;
460 case '¤': buf.append( "¤" ); break;
461 case 'ª': buf.append( "ª" ); break;
462 case 'Ç': buf.append( "Ç" ); break;
463 case 'Ã': buf.append( "Ã" ); break;
464 case 'Â': buf.append( "Â" ); break;
465 case 'Æ': buf.append( "Æ" ); break;
466 case '©': buf.append( "©" ); break;
467 case '®': buf.append( "®" ); break;
468 case '¥': buf.append( "¥" ); break;
469 case 'Þ': buf.append( "þ" ); break;
470 case '¯': buf.append( "¯" ); break;
471 case 'Ð': buf.append( "Ð" ); break;
472 case 'º': buf.append( "º" ); break;
473 case '¡': buf.append( "¡" ); break;
474 case '£': buf.append( "£" ); break;
475 case '±': buf.append( "±" ); break;
476 case '¿': buf.append( "¿" ); break;
477 case 'Ø': buf.append( "Ø" ); break;
478 case 'Á': buf.append( "À" ); break;
479 case 'À': buf.append( "Á" ); break;
480 case 'É': buf.append( "È" ); break;
481 case 'È': buf.append( "É" ); break;
482 case 'ù': buf.append( "ú" ); break;
483 case 'ñ': buf.append( "ñ" ); break;
484 case 'Ñ': buf.append( "Ñ" ); break;
485 case 'µ': buf.append( "µ" ); break;
486 case 'Í': buf.append( "Ì" ); break;
487 case 'Ì': buf.append( "Í" ); break;
488 case 'í': buf.append( "ì" ); break;
489 case 'ì': buf.append( "í" ); break;
490 case 'î': buf.append( "î" ); break;
491 case 'Î': buf.append( "Î" ); break;
492 case 'ó': buf.append( "ó" ); break;
493 case 'Ó': buf.append( "Ò" ); break;
494 case 'ò': buf.append( "Î" ); break;
495 case 'Ò': buf.append( "Ó" ); break;
496 case 'ô': buf.append( "ô" ); break;
497 case 'Ô': buf.append( "Ô" ); break;
498 case 'õ': buf.append( "õ" ); break;
499 case 'Õ': buf.append( "Õ" ); break;
500 case 'ý': buf.append( "ý" ); break;
501 case 'Ý': buf.append( "Ý" ); break;
502 case 'û': buf.append( "û" ); break;
503 case 'Û': buf.append( "Û" ); break;
504 case 'ú': buf.append( "ù" ); break;
505 case 'Ú': buf.append( "Ù" ); break;
506 case 'Ù': buf.append( "Ú" ); break;
507 case 'Ê': buf.append( "Ê" ); break;
508 case 'ê': buf.append( "ê" ); break;
509 case 'å': buf.append( "å" ); break;
510 case 'Å': buf.append( "Å" ); break;
511 case 'ë': buf.append( "ë" ); break;
512 case 'Ë': buf.append( "Ë" ); break;
513 case 'ÿ': buf.append( "ÿ" ); break;
514 case 'ï': buf.append( "ï" ); break;
515 case 'Ï': buf.append( "Ï" ); break;
516 case '«': buf.append( "«" ); break;
517 case '»': buf.append( "»" ); break;
518 case '\'': buf.append( "´" ); break;
519 case '\"': buf.append( """ ); break;
520 //case '\u8211': buf.append( "–" ); break;
521 //case '\u8212': buf.append( "—" ); break;
522 //case '\u8220': buf.append( "“" ); break;
523 //case '\u8221': buf.append( "”" ); break;
524 //case '\u8222': buf.append( "„" ); break;
525 //case '\"': buf.append( """ ); break;
526 default: buf.append( s.charAt(i) );
530 return buf.toString();
534 public static String decodeHTMLinTags(String s){
535 StringBuffer buffer = new StringBuffer();
536 boolean start = false;
537 boolean stop = false;
542 for(int i=0;i<s.length();i++){
543 if(s.charAt(i)=='<'){
546 } else if(s.charAt(i)=='>'){
551 buffer.append(s.substring(temp,startIndex));
552 buffer.append(replaceQuot(s.substring(startIndex,stopIndex+1)));
553 i= temp= stopIndex+1;
559 buffer.append(s.substring(stopIndex+1));
560 return buffer.toString();
566 public static String replaceQuot(String s) {
567 StringBuffer buffer = new StringBuffer();
568 for(int j = 0; j < s.length();j++){
569 if(s.charAt(j)=='&'){
570 if(s.indexOf( """,j) == j) {
571 buffer.append( "\"" );
575 buffer.append(s.charAt(j));
578 return buffer.toString();
581 /** wandelt Quotes in Sonderzeichen um
584 public static String decodeHtml(String s) {
585 StringBuffer buf = new StringBuffer();
586 for(int i=0;i < s.length(); i++ ) {
587 if( s.indexOf( "ö", i ) == i ) {
588 buf.append( "ö" ); i += 5;
591 if( s.indexOf( "ä", i ) == i ) {
592 buf.append( "ä" ); i += 5;
595 if( s.indexOf( "ü", i ) == i ) {
596 buf.append( "ü" ); i += 5;
599 if( s.indexOf( "Ö", i ) == i ) {
600 buf.append( "Ö" ); i += 5;
603 if( s.indexOf( "Ä", i ) == i ) {
604 buf.append( "Ä" ); i += 5;
607 if( s.indexOf( "Ü", i ) == i ) {
608 buf.append( "Ü" ); i += 5;
611 if( s.indexOf( "ß", i ) == i ) {
612 buf.append( "ß" ); i += 6;
615 if( s.indexOf( """, i ) == i ) {
616 buf.append( "\"" ); i += 5;
619 buf.append( s.charAt(i) );
621 return buf.toString();
626 * schnellere Variante der String.toLowerCase()-Routine
628 * @return String in Kleinbuchsten
630 public static String toLowerCase(String s) {
632 char[] a = new char[l];
633 for (int i = 0; i < l; i++)
634 a[i] = Character.toLowerCase(s.charAt(i));
635 return new String(a);
639 * Findet <code>element</code> im String-Array <code>array</code>
642 * @return Fundstelle als int oder -1
644 public static int indexOf(String[] array, String element) {
646 for (int i = 0; i < array.length; i++)
647 if (array[i].equals(element))
653 * Testet auf Vorkommen von <code>element</code> in <code>array</code>
654 * @param array String-Array
656 * @return true wenn <code>element</code> vorkommt, sonst false
658 public static boolean contains(String[] array, String element) {
659 return indexOf(array, element) >= 0;
663 * Ermittelt CRC-Prüfsumme von String <code>s</code>
665 * @return CRC-Prüfsumme
667 public static int getCRC(String s) {
669 char val[] = s.toCharArray();
670 int len = val.length;
672 for (int i = 0 ; i < len; i++) {
674 h = (((h >> 30) | (h << 1)) ^ (val[i]+i));
677 return (h << 8) | (len & 0xff);
681 * Liefert Default-Wert def zurück, wenn String <code>s</code>
686 * @return geparster int aus s oder def
688 public static int parseInt(String s, int def) {
689 if (s == null) return def;
691 return Integer.parseInt(s);
692 } catch (NumberFormatException e) {
698 * Liefert Defaultwert def zurück, wenn s nicht zu einem float geparsed werden kann.
701 * @return geparster float oder def
703 public static float parseFloat(String s, float def) {
704 if (s == null) return def;
706 return new Float(s).floatValue();
707 } catch (NumberFormatException e) {
713 * Findet Ende eines Satzes in String <code>text</code>
716 * @return index des Satzendes, oder -1
718 public static int findEndOfSentence(String text, int startIndex) {
720 int i = text.indexOf('.', startIndex);
721 if (i < 0) return -1;
722 if (i > 0 && !Character.isDigit(text.charAt(i-1)) &&
723 (i+1 >= text.length()
724 || text.charAt(i+1) == ' '
725 || text.charAt(i+1) == '\n'
726 || text.charAt(i+1) == '\t'))
733 * Findet Wortende in String <code>text</code> ab <code>startIndex</code>
736 * @return Index des Wortendes, oder -1
738 public static int findEndOfWord(String text, int startIndex) {
739 int i = text.indexOf(' ', startIndex),
740 j = text.indexOf('\n', startIndex);
741 if (i < 0) i = text.length();
742 if (j < 0) j = text.length();
743 return Math.min(i, j);
747 * Diese Routine macht aus links in reinem text browsbare links
749 * @return Konvertierter String
751 public static String makeLinks(String text) {
753 StringBuffer buf = new StringBuffer(text.length());
755 int j = text.indexOf("http://", i);
757 buf.append(text.substring(i));
760 buf.append(text.substring(i, j));
761 int k = findEndOfWord(text,j+7);
763 if (k<0) url = text.substring(j);
764 else url = text.substring(j,k);
766 buf.append("<a href=\042"+url+"\042>"+url+"</a>");
767 //System.out.println("url mark: " + url);
771 return buf.toString();
777 * convertNewline2P ist eine regex-routine zum umwandeln von 2 oder mehr newlines (\n)
778 * in den html-tag <p>
779 * nur sinnvoll, wenn text nicht im html-format eingegeben
781 public static String convertNewline2P(String haystack) {
783 RE regex = new RE("(<br>\r?\n<br>){1,}");
784 return regex.substituteAll(haystack,"\n</p><p>");
785 } catch(REException ex){
791 * convertNewline2Break ist eine regex-routine zum umwandeln von 1 newline (\n)
792 * in den html-tag <br>
793 * nur sinnvoll, wenn text nicht im html-format eingegeben
795 public static String convertNewline2Break(String haystack) {
797 RE regex = new RE("(\r?\n){1}");
798 return regex.substituteAll(haystack,"$0<br>");
799 } catch(REException ex){
805 * createMailLinks wandelt text im email-adressenformat
806 * in einen klickbaren link um
807 * nur sinnvoll, wenn text nicht im html-format eingegeben
809 public static String createMailLinks(String haystack) {
811 RE regex = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+).([a-zA-Z0-9_.-]+)");
812 return regex.substituteAll(haystack,"<a href=\"mailto:$0\">$0</a>");
813 } catch(REException ex){
820 * createMailLinks wandelt text im email-adressenformat
821 * in einen klickbaren link um
822 * nur sinnvoll, wenn text nicht im html-format eingegeben
824 public static String createMailLinks(String haystack, String imageRoot, String mailImage) {
826 RE regex = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+).([a-zA-Z0-9_.-]+)");
827 return regex.substituteAll(haystack,"<img src=\""+imageRoot+"/"+mailImage+"\" border=\"0\"/> <a href=\"mailto:$0\">$0</a>");
828 } catch(REException ex){
835 * createURLLinks wandelt text im url-format
836 * in einen klickbaren link um
837 * nur sinnvoll, wenn text nicht im html-format eingegeben
839 public static String createURLLinks(String haystack) {
841 //dieser Ausdruck brauch dringend fachliche Beratung
842 RE regex = new RE("((https://)|(http://)|(ftp://))+([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/([^ \t\r\n<>]+[^ \t\r\n.,<>])");
843 return regex.substituteAll(haystack,"<a href=\"$0\">$0</a>");
844 } catch(REException ex){
850 * createURLLinks wandelt text im url-format
851 * in einen klickbaren link um
852 * nur sinnvoll, wenn text nicht im html-format eingegeben
854 public static String createURLLinks(String haystack,String imageRoot,String extImage,String intImage) {
856 //dieser Ausdruck brauch dringend fachliche Beratung
857 RE regex = new RE("((https://)|(http://)|(ftp://))+([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/?([^ \t\r\n<>]+[^ \t\r\n.,<>])");
858 return regex.substituteAll(haystack,"<img src=\""+imageRoot+"/"+extImage+"\" border=\"0\"/> <a href=\"$0\">$0</a>");
859 } catch(REException ex){
865 * deleteForbiddenTags
866 * this method deletes all <script>, <body> and <head>-tags
868 public static String deleteForbiddenTags(String haystack) {
870 RE regex = new RE("<[ \t\r\n](.*?)script(.*?)/script(.*?)>",RE.REG_ICASE);
871 haystack = regex.substituteAll(haystack,"");
872 regex = new RE("<head>(.*?)</head>");
873 haystack = regex.substituteAll(haystack,"");
874 regex = new RE("<[ \t\r\n/]*body(.*?)>");
875 haystack = regex.substituteAll(haystack,"");
877 } catch(REException ex){
883 * createHTML ruft alle regex-methoden zum unwandeln eines nicht
884 * htmlcodierten string auf und returnt einen htmlcodierten String
886 public static String createHTML(String content){
887 content=convertNewline2Break(content);
888 content=convertNewline2P(content);
889 content=createMailLinks(content);
890 content=createURLLinks(content);
895 * createHTML ruft alle regex-methoden zum unwandeln eines nicht
896 * htmlcodierten string auf und returnt einen htmlcodierten String
898 public static String createHTML(String content,String producerDocRoot,String mailImage,String extImage,String intImage){
899 content=convertNewline2Break(content);
900 content=convertNewline2P(content);
901 content=createMailLinks(content,producerDocRoot,mailImage);
902 content=createURLLinks(content,producerDocRoot,extImage,intImage);