ru.biosoft.util
Class TextUtil

java.lang.Object
  extended byru.biosoft.util.TextUtil

public class TextUtil
extends java.lang.Object

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

Version:
2.5.0, 21 February 2000
Author:
Fedor A. Kolpakov

Constructor Summary
TextUtil()
           
 
Method Summary
static void addField(java.lang.StringBuffer str, java.lang.String fieldName, java.lang.String fieldValue)
           
static void addField(java.lang.StringBuffer str, java.lang.String fieldName, java.lang.String fieldValue, int maxFieldLen)
           
static void addField(java.lang.StringBuffer str, java.lang.String fieldName, java.lang.String fieldValue, int maxStrLen, java.lang.String delimiter)
          Add the field to the specified string if the field value is not empty.
static void addField(java.lang.StringBuffer str, java.lang.String fieldName, java.lang.String fieldValue, java.lang.String delimiter)
           
static java.lang.String convertHTML(java.lang.String html)
          Convert HTML document to text.
static java.lang.String getField(java.lang.String entry, java.lang.String field)
          Returns specified field from the specified entry.
static java.lang.String getField(java.lang.String entry, java.lang.String field, char delimiter)
          Returns specified field from the specified entry.
static java.lang.String getSection(java.lang.String section, java.lang.String str)
          Returns the specified section from the specified string.
static java.lang.String getSection(java.lang.String section, java.lang.String str, int offset)
          Returns the specified section from the specified string.
static java.lang.String htmlMakeBold(java.lang.String text)
           
static java.lang.String htmlMakeChangeFont(java.lang.String text, int diff)
           
static java.lang.String htmlMakeHTML(java.lang.String text)
           
static java.lang.String htmlMakeItalic(java.lang.String text)
           
static java.lang.String htmlMakeParagraph(java.lang.String text)
           
static java.lang.String htmlMakeUnderline(java.lang.String text)
           
static java.lang.String insertToString(java.lang.String str, int offset, java.lang.String what)
          Insert the specified string in other string in specified position.
static int parseInt(java.lang.String s, int from)
          Parse integer from the string.
static java.lang.String valueOf(double value, int decDig)
          Returns string, that represents double value, with specified number of decimal didits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtil

public TextUtil()
Method Detail

parseInt

public static int parseInt(java.lang.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
Throws:
java.lang.NumberFormatException

valueOf

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

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

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

insertToString

public static java.lang.String insertToString(java.lang.String str,
                                              int offset,
                                              java.lang.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.

getSection

public static java.lang.String getSection(java.lang.String section,
                                          java.lang.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 java.lang.String getSection(java.lang.String section,
                                          java.lang.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

convertHTML

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


getField

public static java.lang.String getField(java.lang.String entry,
                                        java.lang.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 java.lang.String getField(java.lang.String entry,
                                        java.lang.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(String entry, String field, char delimiter)

addField

public static void addField(java.lang.StringBuffer str,
                            java.lang.String fieldName,
                            java.lang.String fieldValue,
                            int maxStrLen,
                            java.lang.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(java.lang.StringBuffer str,
                            java.lang.String fieldName,
                            java.lang.String fieldValue,
                            int maxFieldLen)

addField

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

addField

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

htmlMakeHTML

public static java.lang.String htmlMakeHTML(java.lang.String text)

htmlMakeBold

public static java.lang.String htmlMakeBold(java.lang.String text)

htmlMakeItalic

public static java.lang.String htmlMakeItalic(java.lang.String text)

htmlMakeUnderline

public static java.lang.String htmlMakeUnderline(java.lang.String text)

htmlMakeParagraph

public static java.lang.String htmlMakeParagraph(java.lang.String text)

htmlMakeChangeFont

public static java.lang.String htmlMakeChangeFont(java.lang.String text,
                                                  int diff)


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.