/// <summary> /// Same as{@link #parseAndKeepRawInput(string, string)}, but accepts a mutable PhoneNumber as /// a parameter to decrease object creation when invoked many times. /// </summary> /// <param name="numberToParse"></param> /// <param name="defaultRegion"></param> /// <param name="phoneNumber"></param> public void ParseAndKeepRawInput(string numberToParse, string defaultRegion, PhoneNumber phoneNumber) { phoneNumberUtil.parseAndKeepRawInput(numberToParse, defaultRegion, phoneNumber); }
/// <summary> /// Takes two phone numbers and compares them for equality. This is a convenience wrapper for /// {@link #isNumberMatch(PhoneNumber, PhoneNumber)}. No default region is known. /// </summary> /// <param name="firstNumber">first number to compare in proto buffer format.</param> /// <param name="secondNumber">second number to compare. Can contain formatting, and can have country /// calling code specified with + at the start.</param> /// <returns>NOT_A_NUMBER, NO_MATCH, SHORT_NSN_MATCH, NSN_MATCH, EXACT_MATCH. See /// {@link #isNumberMatch(PhoneNumber, PhoneNumber)} for more details.</returns> public MatchType IsNumberMatch(PhoneNumber firstNumber, string secondNumber) { return (MatchType)phoneNumberUtil.isNumberMatch(firstNumber, secondNumber); }
/// <summary> /// Same as {@link #parse(string, string)}, but accepts mutable PhoneNumber as a parameter to /// decrease object creation when invoked many times. /// </summary> /// <param name="numberToParse"></param> /// <param name="defaultRegion"></param> /// <param name="phoneNumber"></param> public void Parse(string numberToParse, string defaultRegion, PhoneNumber phoneNumber) { phoneNumberUtil.parse(numberToParse, defaultRegion, phoneNumber); }
/// <summary> /// Gets the expected cost category of a short number (however, nothing is implied about its /// validity). If it is important that the number is valid, then its validity must first be checked /// using {@link isValidShortNumber}. Note that emergency numbers are always considered toll-free. /// Example usage: /// <pre>{@code /// PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); /// ShortNumberInfo shortInfo = ShortNumberInfo.getInstance(); /// PhoneNumber number = phoneUtil.parse("110", "FR"); /// if (shortInfo.isValidShortNumber(number)) { /// ShortNumberInfo.ShortNumberCost cost = shortInfo.getExpectedCost(number); /// // Do something with the cost information here. /// }}</pre> /// </summary> /// <param name="number">the short number for which we want to know the expected cost category</param> /// <returns>the expected cost category of the short number. Returns UNKNOWN_COST if the number does /// not match a cost category. Note that an invalid number may match any cost category.</returns> public ShortNumberCost GetExpectedCost(PhoneNumber number) { return (ShortNumberCost)shortNumberInfo.getExpectedCost(number._inner); }
/// <summary> /// Takes two phone numbers and compares them for equality. /// /// <p>Returns EXACT_MATCH if the country_code, NSN, presence of a leading zero for Italian numbers /// and any extension present are the same. /// Returns NSN_MATCH if either or both has no region specified, and the NSNs and extensions are /// the same. /// Returns SHORT_NSN_MATCH if either or both has no region specified, or the region specified is /// the same, and one NSN could be a shorter version of the other number. This includes the case /// where one has an extension specified, and the other does not. /// Returns NO_MATCH otherwise. /// For example, the numbers +1 345 657 1234 and 657 1234 are a SHORT_NSN_MATCH. /// The numbers +1 345 657 1234 and 345 657 are a NO_MATCH. /// </summary> /// <param name="firstNumberIn">first number to compare</param> /// <param name="secondNumberIn">second number to compare</param> /// <returns>NO_MATCH, SHORT_NSN_MATCH, NSN_MATCH or EXACT_MATCH depending on the level of equality of the two numbers, described in the method definition.</returns> public MatchType IsNumberMatch(PhoneNumber firstNumberIn, PhoneNumber secondNumberIn) { return (MatchType)phoneNumberUtil.isNumberMatch(firstNumberIn, secondNumberIn); }
/// <summary> /// Check whether a short number is a possible number. This provides a more lenient check than /// {@link #isValidShortNumber}. See {@link #isPossibleShortNumber(String, String)} for /// details. /// </summary> /// <param name="number">the short number to check</param> /// <returns>whether the number is a possible short number</returns> public bool IsPossibleShortNumber(PhoneNumber number) { return shortNumberInfo.isPossibleShortNumber(number._inner); }
/// <summary> /// Tests whether a short number matches a valid pattern. Note that this doesn't verify the number /// is actually in use, which is impossible to tell by just looking at the number itself. See /// {@link #isValidShortNumber(String, String)} for details. /// </summary> /// <param name="number">the short number for which we want to test the validity</param> /// <returns>whether the short number matches a valid pattern</returns> public bool IsValidShortNumber(PhoneNumber number) { return shortNumberInfo.isValidShortNumber(number._inner); }
/// <summary> /// Given a valid short number, determines whether it is carrier-specific (however, nothing is /// implied about its validity). If it is important that the number is valid, then its validity /// must first be checked using {@link isValidShortNumber}. /// </summary> /// <param name="number">the valid short number to check</param> /// <returns>whether the short number is carrier-specific (assuming the input was a valid short number).</returns> public bool IsCarrierSpecific(PhoneNumber number) { return shortNumberInfo.isCarrierSpecific(number._inner); }
public bool ExactlySameAs(PhoneNumber other) { return(_inner.exactlySameAs(other._inner)); }
public PhoneNumber MergeFrom(PhoneNumber other) { _inner.mergeFrom(other._inner); return(this); }
public PhoneNumber MergeFrom(PhoneNumber other) { _inner.mergeFrom(other._inner); return this; }
public bool ExactlySameAs(PhoneNumber other) { return _inner.exactlySameAs(other._inner); }