Packagejp.nium.utils
Classpublic final class StringUtil
InheritanceStringUtil Inheritance Object

StringUtil クラスは、文字列操作のためのユーティリティクラスです。 StringUtil クラスを直接インスタンス化することはできません。 new StringUtil() コンストラクタを呼び出すと、ArgumentError 例外がスローされます。 The StringUtil class is an utility class for string operation. StringUtil class can not instanciate directly. When call the new StringUtil() constructor, the ArgumentError exception will be thrown.



Public Methods
 MethodDefined By
  
collectBreak(str:String, newLine:String = null):String
[static] 改行コードを変換して返します。 Convert the line feed code of the specified string and returns.
StringUtil
  
queryToObject(query:String):Object
[static] 指定されたクエリー形式のストリングを Object に変換して返します。 Convert the specified query form string to the Object and returns.
StringUtil
  
repeat(str:String, count:int = 0):String
[static] 指定された文字列を指定された数だけリピートさせた文字列を返します。 Returns the string which repeats the specified string with specified times.
StringUtil
  
toProperType(str:String, priority:Boolean = true):*
[static] 指定されたストリングを適切な型のオブジェクトに変換して返します。 Convert the specified string to the proper object type and returns.
StringUtil
  
toUpperCaseFirstLetter(str:String):String
[static] String の最初の文字を大文字にし、以降の文字を小文字に変換して返します。 Convert the first character to upper case and remain character to lower case of the specified string.
StringUtil
Method Detail
collectBreak()method
public static function collectBreak(str:String, newLine:String = null):String

改行コードを変換して返します。 Convert the line feed code of the specified string and returns.

Parameters

str:String変換したい文字列です。 The string to convert.
 
newLine:String (default = null)変換後の改行コードです。 The line feed code to convert to.

Returns
String変換後の文字列です。 The converted string.

Example
         
queryToObject()method 
public static function queryToObject(query:String):Object

指定されたクエリー形式のストリングを Object に変換して返します。 Convert the specified query form string to the Object and returns.

Parameters

query:Stringクエリー形式のストリングです。 The query form string.

Returns
Object変換後の Object です。 The converted Object.

Example
         var o:Object = StringUtil.queryToObject( "a=A&b=B&c=C" );
         trace( o.a ); // A
         trace( o.b ); // B
         trace( o.c ); // C
         
repeat()method 
public static function repeat(str:String, count:int = 0):String

指定された文字列を指定された数だけリピートさせた文字列を返します。 Returns the string which repeats the specified string with specified times.

Parameters

str:Stringリピートしたい文字列です。 The string to repeat.
 
count:int (default = 0)リピート回数です。 Repeat time.

Returns
Stringリピートされた文字列です。 Repeated string.

Example
         trace( StringUtil.repeat( "A", 0 ) == "" ); // true
         trace( StringUtil.repeat( "A", 1 ) == "A" ); // true
         trace( StringUtil.repeat( "A", 2 ) == "AA" ); // true
         trace( StringUtil.repeat( "ABC", 3 ) == "ABCABCABC" ); // true
         
toProperType()method 
public static function toProperType(str:String, priority:Boolean = true):*

指定されたストリングを適切な型のオブジェクトに変換して返します。 Convert the specified string to the proper object type and returns.

Parameters

str:String変換したいストリングです。 The string to convert.
 
priority:Boolean (default = true)数値化を優先するかどうかです。 Whether it gives priority to expressing numerically or not?

Returns
*変換後のオブジェクトです。 The converted object.

Example
         trace( StringUtil.toProperType( "true" ) == true ); // true
         trace( StringUtil.toProperType( "false" ) == false ); // true
         trace( StringUtil.toProperType( "null" ) == null ); // true
         trace( StringUtil.toProperType( "ABCDE" ) == "ABCDE" ); // true
         trace( StringUtil.toProperType( "100" ) == 100 ); // true
         trace( StringUtil.toProperType( "010" ) == 10 ); // true
         trace( StringUtil.toProperType( "010", false ) == "010" ); // true
         trace( StringUtil.toProperType( "10.0", false ) == "10.0" ); // true
         
toUpperCaseFirstLetter()method 
public static function toUpperCaseFirstLetter(str:String):String

String の最初の文字を大文字にし、以降の文字を小文字に変換して返します。 Convert the first character to upper case and remain character to lower case of the specified string.

Parameters

str:String変換したい文字列です。 The string to convert.

Returns
String変換後の文字列です。 The converted string.

Example
         trace( StringUtil.toUpperCaseFirstLetter( "ABCDE" ) == "Abcde" );
         trace( StringUtil.toUpperCaseFirstLetter( "abcde" ) == "Abcde" );
         trace( StringUtil.toUpperCaseFirstLetter( "aBCDE" ) == "Abcde" );