SafeSubString (クラス)
public abstract SafeSubString {inherits StringInterface}
パッケージ: CURL.IDE.CPA.BASE

A sub-string with dynamically computed size.

説明

This class is similar to SubString except that this class's size property is guaranteed not be larger than the size of string minus start.

コンストラクタ
default:Construct sub string instance.
ファクトリ public {SafeSubString.default
string:StringInterface,
start:int,
length:int
}:{this-class}

プロパティ
for-loop-count:Size for use in for loops.
アクセサ public final inline SafeSubString.for-loop-count:int
length:The intended length of the substring.
アクセサ public abstract SafeSubString.length:int
size:Size of substring.
アクセサ public final inline SafeSubString.size:int
start:Index of the start of the substring.
アクセサ public abstract SafeSubString.start:int
string:The underlying string.
アクセサ public abstract SafeSubString.string:StringInterface
プロパティ 継承 StringInterface: empty?

メソッド
clone:
public sealed {SafeSubString.clone}:{this-class}
get:self 内の指定された文字を返します。
public final inline {SafeSubString.get i:int}:char
substr:self の指定された部分文字列を返します。
public final {SafeSubString.substr start:int, length:int}:String
to-String:self と同一 (==) の String を作成します。
public final {SafeSubString.to-String}:String
メソッド 継承 StringInterface: compare, equal?, find, find-char-class, find-string, prefix?, replace-clone, split, suffix?, tail, to-double, to-InputStream, to-int, to-int64, to-lower-clone, to-upper-clone, trim-clone, trim-left-clone, trim-right-clone
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
default (ファクトリ)
public {SafeSubString.default
string:StringInterface,
start:int,
length:int
}:{this-class}

Construct sub string instance.

説明

Creates a substring of string, with given length and starting at start.

Sets the correspondingly named fields.



プロパティ詳細
for-loop-count (アクセサ)
アクセサ public final inline SafeSubString.for-loop-count:int

Size for use in for loops.

説明

Same as size. Only for use by for syntax.


length (アクセサ)
アクセサ public abstract SafeSubString.length:int

The intended length of the substring.

説明

This is the length of the substring unless this value plus start would point past the end of string.

See size for details.


size (アクセサ)
アクセサ public final inline SafeSubString.size:int

Size of substring.

説明

Returns the lesser of length and size of string minus start.

Provided the underlying string is not changed in the meantime, accessing characters with positive indexes less than the size should not produce range errors.


start (アクセサ)
アクセサ public abstract SafeSubString.start:int

Index of the start of the substring.

説明

The index of the first character in string belonging to this substring.


string (アクセサ)
アクセサ public abstract SafeSubString.string:StringInterface

The underlying string.






メソッド詳細
clone (メソッド)
public sealed {SafeSubString.clone}:{this-class}
この項目はサポートされていません。内部使用限定となっています。


get (メソッド)
public final inline {SafeSubString.get i:int}:char

self 内の指定された文字を返します。

index: 取得する文字の位置。最左端の文字の位置は 0 です。最右端の文字の位置は (self.size - 1) です。有効値は 0(self.size - 1) の範囲です (0(self.size - 1) を含む)。

例外のスロー

index が範囲外の場合は ArrayBoundsException をスローします。


{value
    || Declare and initialize a string.
    let s:String = "Hello World!"

    || Display the string and return the
    || character at position 7.
    || Remember that the leftmost position
    || is 0 (zero).
    {text {value s}
        {br}The character at position 7 is {s.get 7}.}
}

注意事項

これは StringInterface の抽象メソッドです。このメソッドは StringInterface のサブクラスによって実装されます。


substr (メソッド)
public final {SafeSubString.substr start:int, length:int}:String

self の指定された部分文字列を返します。

start: self 内における部分文字列の開始位置。最左端の文字の位置は 0 です。最右端の文字の位置は (self.size - 1) です。有効値は 0 ~ (self.size - 1) の範囲です (0 と (self.size - 1) を含む)。
length: 部分文字列の長さ。つまり、部分文字列内の文字数です。

戻り値

self の指定された部分文字列が格納された String。この部分文字列は、start の位置から始まる length 個の連続した文字です。

注意事項

start または start + length が範囲外を指している場合、このメソッドは ArrayBoundsException をスローします。


{value
    || Declare and initialize s1 (the original string).
    let s1:String = "Hello World!"

    || Initialize s2 with a substring of s1.  The
    || substring begins at position 6 and is 5
    || characters long ("World").
    || Remember that the leftmost position
    || is 0 (zero).
    let s2:String = {s1.substr 6, 5}

    || Display the contents of s2.
    {value s2}
}

注意事項

クローン作成の詳細については、『Curl 開発者ガイド』の「文字列クローンの操作」のセクションを参照してください。


to-String (メソッド)
public final {SafeSubString.to-String}:String

self と同一 (==) の String を作成します。

戻り値

self 内の文字を含む String


{value
    || Define and initialize a StringBuf.
    let sb:StringBuf = {StringBuf "Hello World!"}

    || Convert the StringBuf to a String.
    let s:String = {sb.to-String}

    || Display the contents of the String.
    {value s}
}