Can i use a regex to replace the 4th, 5th, 6th words with * from a string ?
Actually i do this:
public class Test
{
public static void main( String[] args )
{
StringBuilder myName = new StringBuilder("AD-BJR5U");
myName.setCharAt(3, '*');
myName.setCharAt(4, '*');
myName.setCharAt(5, '*');
System.out.println(myName);
}
}
Input:
AD-BJR5U
Output:
AD-***5U
builder.replace(3, 6, "***");