#鸿蒙学习大百科#如何通过号码判断归属地?

如何通过号码判断归属地?

HarmonyOS
2024-10-29 09:57:13
1014浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
后知后觉cy
// 导入模块
import { i18n } from '@kit.LocalizationKit';

@Entry
@Component
struct Index {
  @State str: string = ''

  aboutToAppear(): void {
    // 以某种语言显示号码归属地
    let phoneNumberFormat4 = new i18n.PhoneNumberFormat("CN");
    this.str = phoneNumberFormat4.getLocationName('158****2312', 'en-GB')
  }

  build() {
    Column() {
      Text(this.str)
        .fontSize(30)
        .margin(20)
    }
    .height("100%")
    .width('100%')
    .justifyContent(FlexAlign.Center)
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
分享
微博
QQ
微信
回复
2024-10-29 15:22:34


相关问题
如何获取电话号码归属地
1013浏览 • 1回复 待解决
#鸿蒙学习大百科#ArkTS如何生成xml?
1204浏览 • 1回复 待解决
#鸿蒙学习大百科#如何实现ui优化?
980浏览 • 1回复 待解决