Exemplo n.º 1
0
 public static byte[] Ttl_standardize(byte[] src) {
   int len = src.length;
   if (len == 0) return src;
   byte[] rv = null;
   boolean dirty = false;
   byte b = src[0];
   if (b > 96 && b < 123) {
     dirty = true;
     rv = new byte[len];
     rv[0] =
         (byte)
             (b
                 - 32); // NOTE: [[File:]] automatically uppercases 1st letter for md5;
                        // EX:en.d:File:wikiquote-logo.png has md5 of "32" (W...) not "82" (w...);
                        // PAGE:en.d:freedom_of_speech DATE:2016-01-21
   }
   for (int i = 1; i < len; ++i) {
     b = src[i];
     if (b == Byte_ascii.Space) {
       if (!dirty) {
         dirty = true;
         rv = new byte[len];
         Bry_.Copy_by_pos(src, 0, i, rv, 0);
       }
       rv[i] = Byte_ascii.Underline;
     } else {
       if (dirty) rv[i] = b;
     }
   }
   return dirty ? rv : src;
 }