如何知道短信号码和电话号码是一样的吗? [英] How to know SMS number and phone number is the same?

查看:189
本文介绍了如何知道短信号码和电话号码是一样的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个项目,该项目采用的是Android类似的消息。
有2种类型数:短信号码和电话号码。
例如:我经常收到的短信与电话号码是:84973612399。但是,她的电话号码是0973612399.我怎么知道2号只属于一个人?

I'm working on a project that is similar to Message in android. There are 2 types of number : sms number and phone number. For example : I always receive sms with number is: +84973612399. But her phone number is 0973612399. How can I know that 2 numbers only belongs to a person?

感谢。

推荐答案

使用<一个href=\"http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html#compare%28java.lang.String,%20java.lang.String%29\"相对=nofollow> PhoneNumberUtils.compare 以比较这两个数字。

Use PhoneNumberUtils.compare to compare both numbers.

示例

//Compare phone numbers a and b, return true if they're identical enough for caller ID purposes.
if (PhoneNumberUtils.compare("+84973612399", "0973612399")) {
   Log.d(TAG, "Both are identicaly same"); 
} else {
   Log.d(TAG, "Doesn't match");
}

结果是

两者都是identicaly相同

Both are identicaly same

这篇关于如何知道短信号码和电话号码是一样的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆