I have a sentence that is passed in as a string and I am doing a replace on the word \"and\" and I want to replace it with \" \". And it\'s not replacing the word \"and\" w
package com.tulu.ds;
public class EmailSecurity {
public static void main(String[] args) {
System.out.println(returnSecuredEmailID("sample717@gmail.com"));
}
private static String returnSecuredEmailID(String email){
String str=email.substring(1, email.lastIndexOf("@")-1);
return email.replaceAll(email.substring(1, email.lastIndexOf("@")-1),replacewith(str.length(),"*"));
}
private static String replacewith(int length,String replace) {
String finalStr="";
for(int i=0;i