Java.Util.Scanner.FindWithinHorizon Method
Tries to find the pattern in the input between the current position and the specified horizon.

Syntax

[Android.Runtime.Register("findWithinHorizon", "(Ljava/util/regex/Pattern;I)Ljava/lang/String;", "")]
public string FindWithinHorizon (Java.Util.Regex.Pattern pattern, int horizon)

Parameters

pattern
the pattern used to scan.
horizon
the search limit.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.IllegalStateExceptionif the Scanner is closed.
Java.Lang.IllegalArgumentExceptionif horizon is less than zero.

Remarks

Tries to find the pattern in the input between the current position and the specified horizon. Delimiters are ignored. If the pattern is found, the matched string will be returned, and the Scanner will advance to the end of the matched string. Otherwise, null will be returned and Scanner will not advance. When waiting for input, the Scanner may be blocked.

The Scanner's search will never go more than horizon code points from current position. The position of horizon does have an effect on the result of the match. For example, when the input is "123" and current position is at zero, findWithinHorizon(Pattern.compile("\\p{Digit}{3}"), 2) will return null, while findWithinHorizon(Pattern.compile("\\p{Digit}{3}"), 3) will return "123". horizon is treated as a transparent, non-anchoring bound. (refer to Java.Util.Regex.Matcher.UseTransparentBounds(bool) and Java.Util.Regex.Matcher.UseAnchoringBounds(bool))

A horizon whose value is zero will be ignored and the whole input will be used for search. In this situation, all the input may be cached.

[Android Documentation]

Requirements

Namespace: Java.Util
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1