Instance Method インスタンスメソッド

substringWithRange:

Returns a string object containing the characters of the receiver that lie within a given range. 与えられた範囲内に置かれている、レシーバの文字を含んでいる文字列オブジェクトを返します。

Declaration 宣言

- (NSString *)substringWithRange:(NSRange)range;

Parameters パラメータ

aRange

A range. The range must not exceed the bounds of the receiver. 範囲。範囲は、レシーバの境界を越えてはいけません。

Raises an NSRangeException if (aRange.location - 1) or (aRange.location + aRange.length - 1) lies beyond the end of the receiver. NSRangeExceptionを引き起こします、もし (aRange.location - 1) または (aRange.location + aRange.length - 1) がレシーバの終わりを越えて横たわるならば。

Return Value 戻り値

A string object containing the characters of the receiver that lie within aRange. aRange内に横たわる、レシーバの文字を含んでいる文字列オブジェクト。

Discussion 議論

This method detects all invalid ranges (including those with negative lengths). For applications linked against macOS 10.6 and later, this error causes an exception; for applications linked against earlier releases, this error causes a warning, which is displayed just once per application execution. このメソッドは、すべての無効な範囲を検知します(負の長さでのそれらを含めて)。macOS 10.6以降に対して結び付けられるアプリケーションに対して、このエラーは例外をもたらします;以前のリリースに関連するアプリケーションに対して、このエラーは警告をもたらします、それはアプリケーション例外ごとに一度だけ表示されます。

See Also 参照

Dividing Strings 文字列を分割する