Cell phone number in the middle with an asterisk

Source: Internet
Author: User

. h file


[OBJC] view plain copy

  1. <span style= "FONT-SIZE:18PX;" > /**

  2. * Turn into an asterisk tool

  3.  */   

  4. @interface Asterisktool:nsobject

  5. //Turn the phone number 第4-7位 into an asterisk   

  6. + (nsstring *) Phonenumtoasterisk: (nsstring*) Phonenum;

  7. //Turn the phone number 第5-14位 into an asterisk   

  8. + (nsstring *) Idcardtoasterisk: (nsstring *) Idcardnum;

  9. @end   

. m file


[OBJC] view plain copy

  1. <span style= "FONT-SIZE:18PX;" > @implementation Asterisktool

  2. + (nsstring *) Phonenumtoasterisk: (nsstring*) Phonenum

  3. {

  4. return [phonenum stringbyreplacingcharactersinrange: Nsmakerange (3,4   ) withstring:@ "* * *"];

  5. }

  6. + (nsstring*) Idcardtoasterisk: (nsstring *) Idcardnum

  7. {

  8. return [idcardnum stringbyreplacingcharactersinrange: Nsmakerange (4,   10) withstring:@ "**********"];

  9. }

  10. @end




This was replaced with a nsstring,


This article from "zhuoking" blog, reproduced please contact the author!

Cell phone number in the middle with an asterisk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.