Can we have a "non formatted" postcode for pt_BR localization?
See original GitHub issue- Faker version: 3.0.0
- OS: Windows 10 pro (x64)
I’m using Faker to generate postcode using the pt_BR localization. The example on address
section shows a numeric sequence containing 8 numbers and that was what I expect.
fake.postcode()
# '35285968'
Anyway, I’m getting some problems in my tests because the output of this function sometimes returns a formatted postcode. Example:
fake.postcode()
# '35285968' -- cool :D
fake.postcode()
# '35285-968' -- sad :(
Expected behavior
I would like to generate postcode exactly hows the documentation says, just numbers, without any formatting. As a temporary solution, I’m using a replace
to remove any -
present, but I would like to have a cleaner solution using just Faker. Maybe this “formatted” version can be specified by an argument in the postcode
function.
Actual behavior
Getting a non deterministic postcode, I don’t know which type of postalcode format I will get.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Portuguese Brazil and Portuguese P… - Apple Developer
Hello,. I am using Xcode 8.3.2 and we made our app to support for Portuguese Portugal (PT-PT) localization and it's working fine for...
Read more >Postal code and region issues
Postal code problem: Hello, when I try to add my debit card to account and add postal code, it says "Incorrectly formatted postcode"....
Read more >Incorrectly formatted postal code how do I fix it
I'm trying to buy borderlands the handsome collection on my Xbox one but my postal code Is incorrectly formatted what is the correct...
Read more >GeoIP2 and GeoLite City and Country Databases
For the following countries, we return partial postal codes with the number of characters indicated below: United States: 5; Canada: 3; United Kingdom:...
Read more >Localizing Components | Adyen Docs
Learn how to customize the text displayed in a Component, or create your own localization. If you integrated with our JavaScript Components, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I understand where @reebr might be coming from, because in some systems, postcodes like this are only ever stored in “raw” form, i.e. no dashes, whitespaces, and what-have-you that only serve as visual aids for humans. The visual aids might only be for presentation purposes, e.g. part of the GUI/physical forms to make them easy to fill out or formatted only when displayed to end users, so formatted postcodes can be out of scope for certain use cases.
Perhaps we can do something like this (with better variable names) for similar provider methods as @dunossauro suggested. This way, it will still be backward compatible, and there is an option to only generate the raw forms.
What’s the most common case use in Brazil? Do postcodes ever get printed without the hyphen?