diff options
author | Robert Griesemer <gri@golang.org> | 2009-01-29 17:00:18 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-01-29 17:00:18 -0800 |
commit | 5362c610e210efd2f7fa20dbaadab3127d34f516 (patch) | |
tree | a9ab27e7a2d92dc538f74e519a58be1f063d4516 /usr/gri/gosrc/utils.go | |
parent | 94627488ab01ac7f456dd2ade68070767cb8b8f8 (diff) | |
download | golang-5362c610e210efd2f7fa20dbaadab3127d34f516.tar.gz |
- removed obsolete files from repository
(most of this has been integrated into pretty,
the rest has been archived).
R=r
OCL=23842
CL=23842
Diffstat (limited to 'usr/gri/gosrc/utils.go')
-rw-r--r-- | usr/gri/gosrc/utils.go | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/usr/gri/gosrc/utils.go b/usr/gri/gosrc/utils.go deleted file mode 100644 index 57a8d323a..000000000 --- a/usr/gri/gosrc/utils.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package Utils - - -func BaseName(s string) string { - // TODO this is not correct for non-ASCII strings! - i := len(s) - 1; - for i >= 0 && s[i] != '/' { - if s[i] > 128 { - panic("non-ASCII string"); - } - i--; - } - return s[i + 1 : len(s)]; -} - - -func Contains(s, sub string, pos int) bool { - end := pos + len(sub); - return pos >= 0 && end <= len(s) && s[pos : end] == sub; -} - - -func TrimExt(s, ext string) string { - i := len(s) - len(ext); - if i >= 0 && s[i : len(s)] == ext { - s = s[0 : i]; - } - return s; -} - - -func IntToString(x, base int) string { - x0 := x; - if x < 0 { - x = -x; - if x < 0 { - panic("smallest int not handled"); - } - } else if x == 0 { - return "0"; - } - - // x > 0 - hex := "0123456789ABCDEF"; - var buf [32] byte; - i := len(buf); - for x > 0 { - i--; - buf[i] = hex[x % base]; - x /= base; - } - - if x0 < 0 { - i--; - buf[i] = '-'; - } - - return string(buf)[i : len(buf)]; -} |