For the phone number: 2开发者_如何学Python34-567-8901, I would name variables like:
areaCode = "234";
exchange = "567";
What would an appropriate variable name be for "8901"?
Wikipedia calls it subscriber number.
It is called the line number.
Unless the software is to be used inside a telecommunications company (who would know the correct term), I would go for readability over technical correctness.
Since there is no consensus on the exact term or at least a commonly used name, I would choose something like "fourDigits" over a technically correct term "line number", "extension", "suffix", or "Subscriber line number (SLN)."
From http://en.wikipedia.org/wiki/North_American_Numbering_Plan
For the number 123-456-7890
123 Area Code
456-7890 Subscriber Number
456 Telephone Exchange or Central Office
7890 Line Number
I think the phone number segments are: area code, exchange, and extension. So, the third would be the extension.
This also has the last four digits referenced as the 'subscriber' number or 'station code'.
There is a large Wikipedia article (http://en.wikipedia.org/wiki/Phone_number) that gives a lot of history but no clear term for this part of the number. It may, in some cases, be a subscriber number and in some cases an extension.
Depends on why you're doing it.
- If it's just for you, you can call it "mysticdragonnohala", as long as you can remember it.
- If it's to be memorable within a team project, check with the other developers who'll have to deal with it.
- If it's client-facing, then check with whoever deals with the client the most.
- If it's for a uni course, just make sure it makes sense (or funny) and that it's clearly commented.
Personally I'd go for "line". But "personal", "specific", "individual" "final" and "local" would all make sense.
I've always heard it referred to as the "suffix".
精彩评论