Mask String with characters

后端 未结 5 1580
悲哀的现实
悲哀的现实 2021-01-12 10:46

Hey guy\'s I tried to find a way to hide a string, but the code that I found just work with my application... Is there a way to hide the characters in a string with either <

5条回答
  •  無奈伤痛
    2021-01-12 11:29

    You could easily implement something like this:

    public class MaskedString
    {
        private String data;
    
        public MaskedString(String data){this.data = data;}
        public void append(char c){data += c;}
        public void setData(String data){this.data = data;}
    
        public String getMasked()
        {
            StringBuilder sb = new StringBuilder();
            for(int i=0; i

    You get the idea :)

提交回复
热议问题