after three characters all letter change with asterisk

207 views Asked by At

making a preview form with asp classic for customers. I have data "email field" in db.for example , there is an email address in email_field.

[email protected]

but I want to customers see ;

Joh**********

I could not solve this problem. Which code can I use for this ?

<%=Response.Write email_field %>
<%=Left(rs_mydb("email_field"),3)%>
<%=Replace(rs_mydb("email_field")),"","*"%>
1

There are 1 answers

3
Kul-Tigin On

There's no need to use replace. Instead, you can build a new string to print.

<%
emailFromDb = rs_mydb("email_field")
emailForPrint = Left(emailFromDb, 3) & String(Len(emailFromDb) - 3, "*")
Response.Write emailForPrint
%>