% x inserts spaces between hex bytes in string/*[]byte

R=r
DELTA=7  (7 added, 0 deleted, 0 changed)
OCL=19967
CL=19978
This commit is contained in:
Russ Cox 2008-11-25 09:23:13 -08:00
parent ed490dbed8
commit afff0ff1b8
2 changed files with 4 additions and 0 deletions

View file

@ -374,6 +374,9 @@ func (f *Fmt) s(s string) *Fmt {
func (f *Fmt) sx(s string) *Fmt {
t := "";
for i := 0; i < len(s); i++ {
if i > 0 && f.space {
t += " ";
}
v := s[i];
t += string(ldigits[v>>4]);
t += string(ldigits[v&0xF]);