Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.i18n.phonenumbers
Class PhoneNumberMatch

    java.lang.Object
      com.google.i18n.phonenumbers.PhoneNumberMatch

    public final class PhoneNumberMatch

extends java.lang.Object

The immutable match of a phone number within a piece of text. Matches may be found using `PhoneNumberUtil#findNumbers`.

A match consists of the 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:

     CharSequence text = "Call me at +1 425 882-8080 for details.";
     RegionCode country = RegionCode.US;
     PhoneNumberUtil util = PhoneNumberUtil.getInstance();

     // Find the first phone number match:
     PhoneNumberMatch m = util.findNumbers(text, country).iterator().next();

     // rawString() contains the phone number as it appears in the text.
     "+1 425 882-8080".equals(m.rawString());

     // start() and end() define the range of the matched subsequence.
     CharSequence subsequence = text.subSequence(m.start(), m.end());
     "+1 425 882-8080".contentEquals(subsequence);

     // number() returns the the same result as PhoneNumberUtil.parse()
     // invoked on rawString().
     util.parse(m.rawString(), country).equals(m.number());

Method Summary
`int` | `end()` Returns the exclusive end index of the matched phone number within the searched text.
`boolean` | `equals(java.lang.Object obj)`
`int` | `hashCode()`
`PhoneNumber` | `number()` Returns the phone number matched by the receiver.
`java.lang.String` | `rawString()` Returns the raw string matched as a phone number in the searched text.
`int` | `start()` Returns the start index of the matched phone number within the searched text.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### number

    public PhoneNumber number()

  Returns the phone number matched by the receiver.

### start

    public int start()

  Returns the start index of the matched phone number within the searched text.

### end

    public int end()

  Returns the exclusive end index of the matched phone number within the searched text.

### rawString

    public java.lang.String rawString()

  Returns the raw string matched as a phone number in the searched text.

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD