1 Replies - 4112 Views - Last Post: 10 May 2012 - 11:38 AM Rate Topic: -----

#1 thequi1ter   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-August 09

ReReplacenocase for numbers.

Posted 10 May 2012 - 10:45 AM

I have searched for examples of using REReplacenocase for social security numbers. In reality I'm trying to figure out how to prevent users from viewing hospital patient identification numbers. This is typically, but not always a 9 digit number. I tried this:
 <cfset regNumber = replace(regNumber,"-",chr(0),"ALL") />

but it still displays the entire number. I'd like to remove all or part of the number, sorta like they do with Social Security numbers sometimes where the user can only see the last 4 digits.

Thank you for any suggestions/help with this.

Is This A Good Question/Topic? 0
  • +

Replies To: ReReplacenocase for numbers.

#2 Craig328   User is offline

  • I make this look good
  • member icon

Reputation: 2024
  • View blog
  • Posts: 3,609
  • Joined: 13-January 08

Re: ReReplacenocase for numbers.

Posted 10 May 2012 - 11:38 AM

I'm not entirely sure what you have to start with and what you want when you finish but the code example you provided replaces any dashes you encounter with a null. If you're attempting to remove dashes from a string then you'd like be there although I do it more like this:
 <cfset regNumber = replace(regNumber,"-","","ALL") />

That will indeed display your original number only now without any dashes.

If you're wanting to display only the last 4 digits of your number you use the Left() function. It'd look like this:
<cfset regNumber = Left(regNumber,4) />

Give that a spin and see what that does for you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1