套件 | spark.globalization |
類別 | public class StringTools |
繼承 | StringTools GlobalizationBase AdvancedStyleClient EventDispatcher Object |
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
StringTools
class provides locale-sensitve case
conversion methods.
This class is a wrapper class around the
flash.globalization.StringTools
.
Therefore, the case conversion functionality is provided by the
flash.globalization.StringTools
class.
However, this StringTools
class can be used in MXML
declartions, uses the locale style for the requested Locale ID name, and
has methods and properties that are bindable.
Additionally, events are generated if there is an error or warning
generated by the flash.globalization class.
The flash.globalization.StringTools
class uses the
underlying operating system for the case conversion functionality and
on some operating systems, the flash.globalization
classes
are unsupported, this wrapper class provides fallback that makes use of
the case conversion provided by the String
class.
相關 API 元素
屬性 | 定義自 | ||
---|---|---|---|
actualLocaleIDName : String [覆寫] [唯讀]
The name of the actual locale ID used by this class object. | StringTools | ||
className : String [唯讀]
The name of the component class. | AdvancedStyleClient | ||
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
id : String
The identity of the component. | AdvancedStyleClient | ||
inheritingStyles : Object
An object containing the inheritable styles for this non-visual
style client instance. | AdvancedStyleClient | ||
lastOperationStatus : String [覆寫] [唯讀]
The status of the most recent operation that this class object
performed. | StringTools | ||
moduleFactory : IFlexModuleFactory
A module factory is used as context for
finding the style manager that controls the styles for this
non-visual style client instance. | AdvancedStyleClient | ||
nonInheritingStyles : Object
The beginning of this component's chain of non-inheriting styles. | AdvancedStyleClient | ||
styleDeclaration : CSSStyleDeclaration
The style declaration that holds the inline styles declared by this
object. | AdvancedStyleClient | ||
styleManager : IStyleManager2 [唯讀]
Returns the StyleManager instance used by this component. | AdvancedStyleClient | ||
styleName : Object
The source of this object's style values. | AdvancedStyleClient | ||
styleParent : IAdvancedStyleClient
A component's parent is used to evaluate descendant selectors. | AdvancedStyleClient |
方法 | 定義自 | ||
---|---|---|---|
Constructs a new StringTools object that provides case conversion and
other utilities according to the conventions of a given locale. | StringTools | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | ||
Deletes a style property from this component instance. | AdvancedStyleClient | ||
會將事件傳送到事件流程。 | EventDispatcher | ||
[靜態]
Lists all of the locale ID names supported by this class. | StringTools | ||
Returns an Array of CSSStyleDeclaration objects for the type selector
that applies to this component, or null if none exist. | AdvancedStyleClient | ||
[覆寫]
Gets a style property that has been set anywhere in this
component's style lookup chain. | GlobalizationBase | ||
Returns true if currentCSSState is not null. | AdvancedStyleClient | ||
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | ||
指出物件是否有已定義的指定屬性。 | Object | ||
The initialized method is called when this class or a class that
extends this class is used in an MXML declaration. | AdvancedStyleClient | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
Returns true if cssState matches currentCSSState. | AdvancedStyleClient | ||
Determines whether this instance is the same as, or is a subclass of,
the given type. | AdvancedStyleClient | ||
Propagates style changes to the children of this style client
instance. | AdvancedStyleClient | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
Sets up the internal style cache values so that the
getStyle()
method functions. | AdvancedStyleClient | ||
Registers the EffectManager as one of the event listeners
for each effect event. | AdvancedStyleClient | ||
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
Sets a style property on this component instance. | AdvancedStyleClient | ||
Detects changes to style properties. | AdvancedStyleClient | ||
Flex calls the stylesInitialized() method when
the styles for a component are first initialized. | AdvancedStyleClient | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
Converts a string to lowercase according to language conventions. | StringTools | ||
會傳回指定之物件的字串形式。 | Object | ||
Converts a string to uppercase according to language conventions. | StringTools | ||
會傳回指定之物件的基本值。 | Object | ||
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher |
actualLocaleIDName | 屬性 |
actualLocaleIDName:String
[唯讀] [覆寫] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
The name of the actual locale ID used by this class object. This is the locale that is used to access the formatting data and functionality from the operating system.
If the locale that was set by the locale
style is not available,
then the value of the actualLocaleIDName
is different
from the value of the locale
style.
It indicates the fallback locale that is being used.
If the locale style was set to LocaleID.DEFAULT
the
name of the locale specified by the user's operating system is
used.
此屬性可以做為資料繫結的來源。一旦修改此屬性,將傳送 change
事件。
實作
override public function get actualLocaleIDName():String
相關 API 元素
StringTools()
lastOperationStatus | 屬性 |
lastOperationStatus:String
[唯讀] [覆寫] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
The status of the most recent operation that this class object
performed.
The lastOperationStatus
is set whenever the constructor
or a method of this class is called, or when a property is set.
For the possible values see the description under each method.
此屬性可以做為資料繫結的來源。一旦修改此屬性,將傳送 change
事件。
實作
override public function get lastOperationStatus():String
StringTools | () | 建構函式 |
public function StringTools()
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
Constructs a new StringTools object that provides case conversion and other utilities according to the conventions of a given locale. The locale for this class is supplied by the locale style. The locale style can be set in several ways:
- Inheriting the style from a
UIComponent
by calling the UIComponent's addStyleClient method. - By using the class in an MXML declaration and inheriting the
locale from the document that contains the declaration.
Example:
<fx:Declarations> <s:StringTools id="st" /> </fx:Declarations>
- By using an MXML declaration and specifying the locale value in
the list of assignments.
Example:
<fx:Declarations> <s:StringTools id="st_turkish" locale="tr-TR" /> </fx:Declarations>
- Calling the setStyle method, e.g.
st.setStyle("locale", "tr-TR")
If the locale
style is not set by one of the above
techniques, the instance of this class will be added as a
StyleClient
to the topLevelApplication
and
will therefore inherit the locale
style from the
topLevelApplication
object when the locale
dependent property getter or locale
dependent method is
called.
相關 API 元素
getAvailableLocaleIDNames | () | 方法 |
public static function getAvailableLocaleIDNames():Vector.<String>
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
Lists all of the locale ID names supported by this class.
傳回值Vector.<String> — A vector of strings containing all of the locale ID names
supported by this class and operating system.
|
toLowerCase | () | 方法 |
public function toLowerCase(s:String):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
Converts a string to lowercase according to language conventions. Depending on the locale, the output string length can differ from the input string length.
參數
s:String — String to convert to lowercase.
|
String — The converted lowercase string.
|
相關 API 元素
toUpperCase | () | 方法 |
public function toUpperCase(s:String):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | Flash Player 10.1, AIR 2.5 |
Converts a string to uppercase according to language conventions. Depending on the locale, the output string length can differ from the input string length.
參數
s:String — String to convert to uppercase.
|
String — The converted uppercase string.
|
相關 API 元素
<?xml version="1.0" encoding="utf-8"?> <!-- Sample program for spark.globalization.StringTools --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Declarations> <s:StringTools id="stringTools" /> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; private static const localeList:ArrayCollection = new ArrayCollection([ { label:"Turkish (tr)", data:"tr" }, { label:"Greek (el)", data:"el" }, { label:"German (de)", data:"de" }, { label:"English (en)", data:"en" } ]); private static const inputString:String = "aá�æ� Iıİi (Turkish), σςΣΣ (Greek), SSß (German), bβв (Latin/Greek/Cyrillic)"; ]]> </fx:Script> <mx:Form width="100%"> <mx:FormItem label="Select Language"> <mx:ComboBox id="localeSelector" change="setStyle('locale', localeSelector.selectedItem.data);" dataProvider="{localeList}"/> </mx:FormItem> <mx:FormItem label="Actual Locale ID Name"> <mx:Text text="{stringTools.actualLocaleIDName}"/> </mx:FormItem> <mx:FormItem width="100%" label="Upper Case Result"> <mx:Text width="100%" text="{stringTools.toUpperCase(inputString)}"/> </mx:FormItem> <mx:FormItem width="100%" label="Lower Case Result"> <mx:Text width="100%" text="{stringTools.toLowerCase(inputString)}"/> </mx:FormItem> </mx:Form> </s:Application>
Tue Jun 12 2018, 03:47 PM Z