Java Utililty Methods String Blur

List of utility methods to do String Blur

  1. HOME
  2. Java
  3. S
  4. String Blur

Description

The list of methods to do String Blur are organized into topic(s).

Method

String blur(String s)
replaces everything but the first and last letter of the input string s by '.'
if (!BLUR)
 return s;
if (s == null || s.length() <= 1)
 return s;
char c[] = s.toCharArray();
for (int i = 1; i < s.length() - 1; i++)
 c[i] = '.';
return new String(c);
...
String blurKeepingExtension(String s)
blurs a filename but keeps the extension intact.
if (s == null)
 return null;
int idx = s.lastIndexOf(".");
if (idx <= 0)
 return blur(s); 
int MAX_EXTENSION_LENGTH = 6;
if (s.length() - idx > MAX_EXTENSION_LENGTH)
 return blur(s); 
...

AltStyle によって変換されたページ (->オリジナル) /