Skip to content

Commit

Permalink
ParseWithOptions Opensource CPP Version
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KarolJakubKrawiec committed Jan 29, 2025
1 parent ddcfb51 commit 2b6d054
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cpp/src/phonenumbers/phonenumberutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/phonenumbers/phonenumberutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2b6d054

Please sign in to comment.