PhoneNumberMatch class
The immutable match of a phone number within a piece of text. Matches may be found using PhoneNumberUtil.findNumbers.
A match consists of the [number] phone number as well as the [start] and [end] offsets of the corresponding subsequence of the searched text. Use [rawString] to obtain a copy of the matched subsequence.
The following annotated example clarifies the relationship between the searched text, the match offsets, and the parsed number:
String text = "Call me at +1 425 882-8080 for details."; String country = "US"; PhoneNumberUtil util = PhoneNumberUtil.instance; // Find the first phone number match: PhoneNumberMatch m = util.findNumbers(text, country).iterator.current; // rawString contains the phone number as it appears in the text. "+1 425 882-8080" == m.rawString; // start and end define the range of the matched subsequence. String subsequence = text.subSequence(m.start, m.end); "+1 425 882-8080" == subsequence; // number returns the the same result as [PhoneNumberUtil.parse] // invoked on rawString. util.parse(m.rawString, country).equals(m.number);
Constructors
- PhoneNumberMatch(int start, String rawString, PhoneNumber number)
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override