org.apache.commons.lang
クラス WordUtils

java.lang.Object
  拡張org.apache.commons.lang.WordUtils

public class WordUtils
extends Object

Operations on Strings that contain words.

This class tries to handle null input gracefully. An exception will not be thrown for a null input. Each method documents its behaviour in more detail.

導入されたバージョン:
2.0
バージョン:
$Id: WordUtils.java,v 1.1.1.1 2004/02/13 10:02:05 hioki Exp $
作成者:
Apache Jakarta Velocity, Henri Yandell, Stephen Colebourne, Henning P. Schmiedehausen, Gary Gregory
翻訳状況:
訳者募集中

コンストラクタの概要
WordUtils()
          WordWrapUtils instances should NOT be constructed in standard programming.
 
メソッドの概要
static String capitalize(String str)
          Capitalizes all the whitespace separated words in a String.
static String capitalizeFully(String str)
          Capitalizes all the whitespace separated words in a String.
static String swapCase(String str)
          Swaps the case of a String using a word based algorithm.
static String uncapitalize(String str)
          Uncapitalizes all the whitespace separated words in a String.
static String wrap(String str, int wrapLength)
          Wraps a single line of text, identifying words by ' '.
static String wrap(String str, int wrapLength, String newLineStr, boolean wrapLongWords)
          Wraps a single line of text, identifying words by ' '.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

WordUtils

public WordUtils()

WordWrapUtils instances should NOT be constructed in standard programming. Instead, the class should be used as WordWrapUtils.wrap("foo bar", 20);.

This constructor is public to permit tools that require a JavaBean instance to operate.

メソッドの詳細

wrap

public static String wrap(String str,
                          int wrapLength)

Wraps a single line of text, identifying words by ' '.

New lines will be separated by the system property line separator. Very long words, such as URLs will not be wrapped.

Leading spaces on a new line are stripped. Trailing spaces are not stripped.

 WordUtils.wrap(null, *) = null
 WordUtils.wrap("", *) = ""
 

パラメータ:
str - the String to be word wrapped, may be null
wrapLength - the column to wrap the words at, less than 1 is treated as 1
戻り値:
a line with newlines inserted, null if null input

wrap

public static String wrap(String str,
                          int wrapLength,
                          String newLineStr,
                          boolean wrapLongWords)

Wraps a single line of text, identifying words by ' '.

Leading spaces on a new line are stripped. Trailing spaces are not stripped.

 WordUtils.wrap(null, *, *, *) = null
 WordUtils.wrap("", *, *, *) = ""
 

パラメータ:
str - the String to be word wrapped, may be null
wrapLength - the column to wrap the words at, less than 1 is treated as 1
newLineStr - the string to insert for a new line, null uses the system property line separator
wrapLongWords - true if long words (such as URLs) should be wrapped
戻り値:
a line with newlines inserted, null if null input

capitalize

public static String capitalize(String str)

Capitalizes all the whitespace separated words in a String. Only the first letter of each word is changed. To change all letters to the capitalized case, use capitalizeFully(String).

Whitespace is defined by Character.isWhitespace(char). A null input String returns null. Capitalization uses the unicode title case, normally equivalent to upper case.

 WordUtils.capitalize(null)        = null
 WordUtils.capitalize("")          = ""
 WordUtils.capitalize("i am FINE") = "I Am FINE"
 

パラメータ:
str - the String to capitalize, may be null
戻り値:
capitalized String, null if null String input
関連項目:
uncapitalize(String), capitalizeFully(String)

capitalizeFully

public static String capitalizeFully(String str)

Capitalizes all the whitespace separated words in a String. All letters are changed, so the resulting string will be fully changed.

Whitespace is defined by Character.isWhitespace(char). A null input String returns null. Capitalization uses the unicode title case, normally equivalent to upper case.

 WordUtils.capitalize(null)        = null
 WordUtils.capitalize("")          = ""
 WordUtils.capitalize("i am FINE") = "I Am Fine"
 

パラメータ:
str - the String to capitalize, may be null
戻り値:
capitalized String, null if null String input

uncapitalize

public static String uncapitalize(String str)

Uncapitalizes all the whitespace separated words in a String. Only the first letter of each word is changed.

Whitespace is defined by Character.isWhitespace(char). A null input String returns null.

 WordUtils.uncapitalize(null)        = null
 WordUtils.uncapitalize("")          = ""
 WordUtils.uncapitalize("I Am FINE") = "i am fINE"
 

パラメータ:
str - the String to uncapitalize, may be null
戻り値:
uncapitalized String, null if null String input
関連項目:
capitalize(String)

swapCase

public static String swapCase(String str)

Swaps the case of a String using a word based algorithm.

Whitespace is defined by Character.isWhitespace(char). A null input String returns null.

 StringUtils.swapCase(null)                 = null
 StringUtils.swapCase("")                   = ""
 StringUtils.swapCase("The dog has a BONE") = "tHE DOG HAS A bone"
 

パラメータ:
str - the String to swap case, may be null
戻り値:
the changed String, null if null String input


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation