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

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

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

問題描述

限時送ChatGPT賬號..

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

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

給定一個電話號碼"和國家/地區 ID(比如說 ISO 國家/地區代碼),我想將其轉換為標準 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?

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

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

最后一個是我最喜歡的 - 這是一些人在英國寫他們的號碼的方式,這意味著你應該使用 +44 或你應該使用 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 格式編號應為全數字,并使用完整的國際國家代碼(例如+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));

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

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

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
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 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 欧美片网站免费 | 人人澡人人射 | 另类 综合 日韩 欧美 亚洲 | 久久高清免费视频 | 一区二区三区av | 免费啪啪 | 免费观看羞羞视频网站 | 午夜精品一区 | 国产精品永久免费视频 | 国产精品国产成人国产三级 | 在线伊人网 | 免费特级黄毛片 | 99视频久| 亚洲国产一区在线 | 免费黄篇| 精品九九九 | 一区二区三区免费 | 亚洲视频在线一区 | 欧美日韩国产一区 | 国产精品视频播放 | 国产精品高潮呻吟久久av野狼 | 亚洲三区在线观看 | 操久久| 干一干操一操 | 国产精品自拍一区 | 9999久久| 91一区二区三区 | 中文字幕一区二区三区四区 | 日韩欧美国产一区二区 | 毛片黄| 麻豆久久久久 | 欧美成人激情 | 欧美午夜精品 | 日韩一区二区三区精品 | 亚洲伊人久久综合 | 国产 欧美 日韩 一区 | 日韩精品免费在线 | 免费的日批视频 | 一区二区三区视频在线免费观看 | 伊人网99| 国产电影一区二区在线观看 |