HEADER

ru.biosoft.util
Class TextUtil


public class TextUtil

Различные утилиты для работы с текстовыми данными.

Version: 2.5.0, 21 February 2000

Method Summary
 static voidaddField(StringBuffer str, String fieldName, String fieldValue, int maxStrLen, String delimiter)
          Add the field to the specified string if the field value is not empty.
 static voidaddField(StringBuffer str, String fieldName, String fieldValue, int maxFieldLen)
           
 static voidaddField(StringBuffer str, String fieldName, String fieldValue)
           
 static voidaddField(StringBuffer str, String fieldName, String fieldValue, String delimiter)
           
 static StringconvertHTML(String html)
          Convert HTML document to text.
 static StringgetField(String entry, String field, char delimiter)
          Returns specified field from the specified entry.
 static StringgetField(String entry, String field)
          Returns specified field from the specified entry.
 static StringgetSection(String section, String str, int offset)
          Returns the specified section from the specified string.
 static StringgetSection(String section, String str)
          Returns the specified section from the specified string.
 static StringhtmlMakeBold(String text)
           
 static StringhtmlMakeChangeFont(String text, int diff)
           
 static StringhtmlMakeHTML(String text)
           
 static StringhtmlMakeItalic(String text)
           
 static StringhtmlMakeParagraph(String text)
           
 static StringhtmlMakeUnderline(String text)
           
 static StringinsertToString(String str, int offset, String what)
          Insert the specified string in other string in specified position.
 static intparseInt(String s, int from)
          Parse integer from the string.
 static StringvalueOf(float value, int decDig)
          Returns string, that represents float value, with specified number of decimal didits.

Method Detail

addField

public static void addField(StringBuffer str, String fieldName, String fieldValue, int maxStrLen, String delimiter)
Add the field to the specified string if the field value is not empty.
Parameters:
str - string to which the field name and value will be added.
fieldName - field name.
fieldValue - field value
maxStrLen - the maximum field string length. If the field value is longer then maxFieldLen, it will be divided to several strings.

addField

public static void addField(StringBuffer str, String fieldName, String fieldValue, int maxFieldLen)

addField

public static void addField(StringBuffer str, String fieldName, String fieldValue)

addField

public static void addField(StringBuffer str, String fieldName, String fieldValue, String delimiter)

convertHTML

public static String convertHTML(String html)
Convert HTML document to text.

getField

public static String getField(String entry, String field, char delimiter)
Returns specified field from the specified entry.

If field consists from several lines, they must be a single block, without other fields inside them.

Parameters:
entry - entry text
field - field (line) name
delimiter - if the field consists from several lines the specified character will be inserted as delimiter between lines.

getField

public static String getField(String entry, String field)
Returns specified field from the specified entry.

If the field consists from several lines space is used as delimiter.

Parameters:
entry - entry text
field - field (line) name
See Also:
getField(java.lang.String,java.lang.String,char)

getSection

public static String getSection(String section, String str, int offset)
Returns the specified section from the specified string. Section is substring between
and
.
Parameters:
section - section name
str - the string containing this section
offset - position in the string from wich first section will be found.

getSection

public static String getSection(String section, String str)
Returns the specified section from the specified string. Section is substring between
and
.
Parameters:
section - section name
str - the string containing this section

htmlMakeBold

public static String htmlMakeBold(String text)

htmlMakeChangeFont

public static String htmlMakeChangeFont(String text, int diff)

htmlMakeHTML

public static String htmlMakeHTML(String text)

htmlMakeItalic

public static String htmlMakeItalic(String text)

htmlMakeParagraph

public static String htmlMakeParagraph(String text)

htmlMakeUnderline

public static String htmlMakeUnderline(String text)

insertToString

public static String insertToString(String str, int offset, String what)
Insert the specified string in other string in specified position.
Parameters:
str - the string for insertion.
offset - the insertion positin.
what - the inserted string.

parseInt

public static int parseInt(String s, int from)
throws java.lang.NumberFormatException
Parse integer from the string. String can contains leading and trailing spaces.
Parameters:
s - string that contains the integer
from - start position in the string

valueOf

public static String valueOf(float value, int decDig)
Returns string, that represents float value, with specified number of decimal didits.

If the value indeed is the integer, than the decimal digits are omitted.

Parameters:
value - float value
decDig - number of decimal digits

FOOTER

BOTTOM