久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Java 將電話號碼轉(zhuǎn)換為國際格式 (E.164) 的最

What is the best way for converting phone numbers into international format (E.164) using Java?(使用 Java 將電話號碼轉(zhuǎn)換為國際格式 (E.164) 的最佳方法是什么?)
本文介紹了使用 Java 將電話號碼轉(zhuǎn)換為國際格式 (E.164) 的最佳方法是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

使用 Java 將電話號碼轉(zhuǎn)換為國際格式 (E.164) 的最佳方法是什么?

What is the best way for converting phone numbers into international format (E.164) using Java?

給定一個電話號碼"和國家/地區(qū) ID(比如說 ISO 國家/地區(qū)代碼),我想將其轉(zhuǎn)換為標(biāo)準(zhǔn) E.164 國際格式電話號碼.

Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number.

我確信我可以很容易地手動完成 - 但我不確定它在所有情況下都能正常工作.

I am sure I can do it by hand quite easily - but I would not be sure it would work correctly in all situations.

您會推薦哪個 Java 框架/庫/實用程序來完成此操作?

Which Java framework/library/utility would you recommend to accomplish this?

附:電話號碼"可以是公眾可以識別的任何內(nèi)容 - 例如

P.S. The 'phone number' could be anything identifiable by the general public - such as

* (510) 786-0404
* 1-800-GOT-MILK
* +44-(0)800-7310658

最后一個是我最喜歡的 - 這是一些人在英國寫他們的號碼的方式,這意味著你應(yīng)該使用 +44 或你應(yīng)該使用 0.

that last one is my favourite - it is how some people write their number in the UK and means that you should either use the +44 or you should use the 0.

E.164 格式編號應(yīng)為全數(shù)字,并使用完整的國際國家代碼(例如+44)

The E.164 format number should be all numeric, and use the full international country code (e.g.+44)

推薦答案

Google 提供了一個用于處理電話號碼的庫.與他們用于 Android 的相同

Google provides a library for working with phone numbers. The same one they use for Android

http://code.google.com/p/libphonenumber/

String swissNumberStr = "044 668 18 00"
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
try {
  PhoneNumber swissNumberProto = phoneUtil.parse(swissNumberStr, "CH");
} catch (NumberParseException e) {
  System.err.println("NumberParseException was thrown: " + e.toString());
}

// Produces "+41 44 668 18 00"
System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.INTERNATIONAL));
// Produces "044 668 18 00"
System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.NATIONAL));
// Produces "+41446681800"
System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.E164));

這篇關(guān)于使用 Java 將電話號碼轉(zhuǎn)換為國際格式 (E.164) 的最佳方法是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 99pao成人国产永久免费视频 | 久久99精品久久久久久国产越南 | 中文字幕在线一区 | 国产xxxx岁13xxxxhd| 久久久蜜臀国产一区二区 | 欧美精品在线播放 | 日日爱夜夜操 | 色婷婷综合久久久中字幕精品久久 | 最新国产在线 | 精品在线99 | 国产精品亚洲精品日韩已方 | 精品成人av | 日韩欧美在线免费 | 福利av在线| 91麻豆精品一区二区三区 | 久久精品免费观看 | 亚洲区一区二 | 精品欧美一区免费观看α√ | 亚洲三级在线观看 | 国内精品久久久久 | www.99久久.com| 伊人春色成人 | 91视频88av | 久久精品亚洲精品国产欧美 | 亚洲一页| 精品国产欧美一区二区三区不卡 | 黄色大片网站 | 久久久91精品国产一区二区三区 | 中文无吗 | 久久久久久国产精品 | 婷婷久久一区 | 日本三级网址 | 亚洲+变态+欧美+另类+精品 | 成人av免费网站 | 国产欧美精品一区二区三区 | 国产成人免费视频 | 亚洲精品视频一区 | 欧美一区二区三区在线播放 | 欧美一区二区三区久久精品 | 操视频网站 | 日韩免费视频一区二区 |