Browse Source

ParseWithOptions Opensource CPP Version

We created a new function that allows the user for customized parsing. You can choose based on what you want the numbers to be parsed.
pull/3730/head
KarolJakubKrawiec 11 months ago
parent
commit
2b6d054360
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      cpp/src/phonenumbers/phonenumberutil.cc
  2. +3
    -1
      cpp/src/phonenumbers/phonenumberutil.h

+ 1
- 1
cpp/src/phonenumbers/phonenumberutil.cc View File

@ -2134,7 +2134,7 @@ PhoneNumberUtil::ErrorType PhoneNumberUtil::Parse(const string& number_to_parse,
number);
}
PhoneNumberUtil::ErrorType PhoneNumberUtil::ParseWithOptions(const absl::string_view number_to_parse,
PhoneNumberUtil::ErrorType PhoneNumberUtil::ParseWithOptions(const string& number_to_parse,
const ParsingOptions& options,
PhoneNumber* number) const {
DCHECK(number);


+ 3
- 1
cpp/src/phonenumbers/phonenumberutil.h View File

@ -723,7 +723,7 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// Parses a string and returns it in proto buffer format. This method differs
// from Parse() in that it allows the caller to change the behavior of the
// parser. See ParsingOptions for more details.
ErrorType ParseWithOptions(const absl::string_view number_to_parse,
ErrorType ParseWithOptions(const string& number_to_parse,
const ParsingOptions& options,
PhoneNumber* number) const;
@ -981,11 +981,13 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
bool check_region,
PhoneNumber* phone_number) const;
ErrorType ParseHelper(const absl::string_view number_to_parse,
const string& default_region,
bool keep_raw_input,
bool check_region,
PhoneNumber* phone_number) const;
absl::optional<string> ExtractPhoneContext(
const string& number_to_extract_from,


Loading…
Cancel
Save