summaryrefslogtreecommitdiff
path: root/src/pkg/strconv
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-20 11:45:05 -0800
committerRuss Cox <rsc@golang.org>2009-11-20 11:45:05 -0800
commitc861f30835090bbd6b9b35a80667f26952843767 (patch)
tree645bd57ef3c9326ec02e646a751b9075d12a79e7 /src/pkg/strconv
parent7089e97992d5d6be520dfea787200061992526c8 (diff)
downloadgolang-c861f30835090bbd6b9b35a80667f26952843767.tar.gz
gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
Diffstat (limited to 'src/pkg/strconv')
-rw-r--r--src/pkg/strconv/atoi.go6
-rw-r--r--src/pkg/strconv/atoi_test.go6
-rw-r--r--src/pkg/strconv/ftoa.go2
-rw-r--r--src/pkg/strconv/itoa.go2
-rw-r--r--src/pkg/strconv/quote.go14
5 files changed, 15 insertions, 15 deletions
diff --git a/src/pkg/strconv/atoi.go b/src/pkg/strconv/atoi.go
index a9d03dac1..bcfaf2ce5 100644
--- a/src/pkg/strconv/atoi.go
+++ b/src/pkg/strconv/atoi.go
@@ -56,7 +56,7 @@ func Btoui64(s string, b int) (n uint64, err os.Error) {
switch {
case s[0] == '0' && len(s) > 1 && (s[1] == 'x' || s[1] == 'X'):
b = 16;
- s = s[2:len(s)];
+ s = s[2:];
if len(s) < 1 {
err = os.EINVAL;
goto Error;
@@ -140,10 +140,10 @@ func Btoi64(s string, base int) (i int64, err os.Error) {
s0 := s;
neg := false;
if s[0] == '+' {
- s = s[1:len(s)]
+ s = s[1:]
} else if s[0] == '-' {
neg = true;
- s = s[1:len(s)];
+ s = s[1:];
}
// Convert unsigned and check range.
diff --git a/src/pkg/strconv/atoi_test.go b/src/pkg/strconv/atoi_test.go
index 58554d304..37027aa6f 100644
--- a/src/pkg/strconv/atoi_test.go
+++ b/src/pkg/strconv/atoi_test.go
@@ -70,7 +70,7 @@ var atoi64tests = []atoi64Test{
atoi64Test{"98765432100", 98765432100, nil},
atoi64Test{"-98765432100", -98765432100, nil},
atoi64Test{"9223372036854775807", 1<<63 - 1, nil},
- atoi64Test{"-9223372036854775807", -(1 << 63 - 1), nil},
+ atoi64Test{"-9223372036854775807", -(1<<63 - 1), nil},
atoi64Test{"9223372036854775808", 1<<63 - 1, os.ERANGE},
atoi64Test{"-9223372036854775808", -1 << 63, nil},
atoi64Test{"9223372036854775809", 1<<63 - 1, os.ERANGE},
@@ -94,7 +94,7 @@ var btoi64tests = []atoi64Test{
atoi64Test{"98765432100", 98765432100, nil},
atoi64Test{"-98765432100", -98765432100, nil},
atoi64Test{"9223372036854775807", 1<<63 - 1, nil},
- atoi64Test{"-9223372036854775807", -(1 << 63 - 1), nil},
+ atoi64Test{"-9223372036854775807", -(1<<63 - 1), nil},
atoi64Test{"9223372036854775808", 1<<63 - 1, os.ERANGE},
atoi64Test{"-9223372036854775808", -1 << 63, nil},
atoi64Test{"9223372036854775809", 1<<63 - 1, os.ERANGE},
@@ -140,7 +140,7 @@ var atoi32tests = []atoi32Test{
atoi32Test{"987654321", 987654321, nil},
atoi32Test{"-987654321", -987654321, nil},
atoi32Test{"2147483647", 1<<31 - 1, nil},
- atoi32Test{"-2147483647", -(1 << 31 - 1), nil},
+ atoi32Test{"-2147483647", -(1<<31 - 1), nil},
atoi32Test{"2147483648", 1<<31 - 1, os.ERANGE},
atoi32Test{"-2147483648", -1 << 31, nil},
atoi32Test{"2147483649", 1<<31 - 1, os.ERANGE},
diff --git a/src/pkg/strconv/ftoa.go b/src/pkg/strconv/ftoa.go
index a285b6402..7300cd861 100644
--- a/src/pkg/strconv/ftoa.go
+++ b/src/pkg/strconv/ftoa.go
@@ -397,7 +397,7 @@ func fmtB(neg bool, mant uint64, exp int, flt *floatInfo) string {
w--;
buf[w] = '-';
}
- return string(buf[w:len(buf)]);
+ return string(buf[w:]);
}
func max(a, b int) int {
diff --git a/src/pkg/strconv/itoa.go b/src/pkg/strconv/itoa.go
index 65d60d79c..bb4810453 100644
--- a/src/pkg/strconv/itoa.go
+++ b/src/pkg/strconv/itoa.go
@@ -20,7 +20,7 @@ func Uitob64(u uint64, base uint) string {
u /= b;
}
- return string(buf[j:len(buf)]);
+ return string(buf[j:]);
}
// Itob64 returns the string representation of i in the given base.
diff --git a/src/pkg/strconv/quote.go b/src/pkg/strconv/quote.go
index 2e4ab1c3c..5b5911db0 100644
--- a/src/pkg/strconv/quote.go
+++ b/src/pkg/strconv/quote.go
@@ -21,7 +21,7 @@ const lowerhex = "0123456789abcdef"
func Quote(s string) string {
var buf bytes.Buffer;
buf.WriteByte('"');
- for ; len(s) > 0; s = s[1:len(s)] {
+ for ; len(s) > 0; s = s[1:] {
switch c := s[0]; {
case c == '"':
buf.WriteString(`\"`)
@@ -49,7 +49,7 @@ func Quote(s string) string {
if r == utf8.RuneError && size == 1 {
goto EscX
}
- s = s[size-1 : len(s)]; // next iteration will slice off 1 more
+ s = s[size-1:]; // next iteration will slice off 1 more
if r < 0x10000 {
buf.WriteString(`\u`);
for j := uint(0); j < 4; j++ {
@@ -118,9 +118,9 @@ func UnquoteChar(s string, quote byte) (value int, multibyte bool, tail string,
return;
case c >= utf8.RuneSelf:
r, size := utf8.DecodeRuneInString(s);
- return r, true, s[size:len(s)], nil;
+ return r, true, s[size:], nil;
case c != '\\':
- return int(s[0]), false, s[1:len(s)], nil
+ return int(s[0]), false, s[1:], nil
}
// hard case: c is backslash
@@ -129,7 +129,7 @@ func UnquoteChar(s string, quote byte) (value int, multibyte bool, tail string,
return;
}
c := s[1];
- s = s[2:len(s)];
+ s = s[2:];
switch c {
case 'a':
@@ -169,7 +169,7 @@ func UnquoteChar(s string, quote byte) (value int, multibyte bool, tail string,
}
v = v<<4 | x;
}
- s = s[n:len(s)];
+ s = s[n:];
if c == 'x' {
// single-byte string, possibly not UTF-8
value = v;
@@ -194,7 +194,7 @@ func UnquoteChar(s string, quote byte) (value int, multibyte bool, tail string,
}
v = (v << 3) | x;
}
- s = s[2:len(s)];
+ s = s[2:];
if v > 255 {
err = os.EINVAL;
return;