aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/strings
AgeCommit message (Collapse)Author
2012-03-05strings: Rename example to match function name.Volker Dobler
R=golang-dev, adg CC=golang-dev https://golang.org/cl/5729065
2012-02-27strings: make Count example show resultsRobert Griesemer
Thanks to dr.volker.dobler for tracking this down. Filed a long-term issue (3142) which may eventually resolve this problem w/o the need for a manual fix. R=iant CC=golang-dev https://golang.org/cl/5698078
2012-02-16godoc: make example code more readable with new comment conventionAndrew Gerrand
go/doc: move Examples to go/ast cmd/go: use go/doc to read examples src/pkg: update examples to use new convention This is to make whole file examples more readable. When presented as a complete function, preceding an Example with its output is confusing. The new convention is to put the expected output in the final comment of the example, preceded by the string "output:" (case insensitive). An idiomatic example looks like this: // This example demonstrates Foo by doing bar and quux. func ExampleFoo() { // example body that does bar and quux // Output: // example output } R=rsc, gri CC=golang-dev https://golang.org/cl/5673053
2012-02-15strings: add Bernardo O'Higgins exampleAndrew Gerrand
R=r, bradfitz CC=golang-dev, rogpeppe https://golang.org/cl/5673049
2012-02-15bytes,strings: make *Reader implement io.ReaderAtBrad Fitzpatrick
R=golang-dev, adg, bradfitz, r CC=golang-dev https://golang.org/cl/5675053
2012-02-13strings: more examplesBrad Fitzpatrick
R=golang-dev, adg CC=golang-dev https://golang.org/cl/5645092
2012-02-10strings: delete method comments implied by interface satisfactionRob Pike
Fixes #2957. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5653053
2012-02-09strings: add Seek method to ReaderBrad Fitzpatrick
strings.Reader is already stateful and read-only. This permits a *Reader with http.ServeContent. R=golang-dev, r, rsc, rsc CC=golang-dev https://golang.org/cl/5639068
2012-02-03strings: add Fields exampleBrad Fitzpatrick
R=golang-dev, rsc, r CC=golang-dev https://golang.org/cl/5629043
2012-01-30build: remove Make.pkg, Make.toolRuss Cox
Consequently, remove many package Makefiles, and shorten the few that remain. gomake becomes 'go tool make'. Turn off test phases of run.bash that do not work, flagged with $BROKEN. Future CLs will restore these, but this seemed like a big enough CL already. R=golang-dev, r CC=golang-dev https://golang.org/cl/5601057
2011-12-20panics: use the new facilities of testing.B insteadRob Pike
Lots of panics go away. Also fix a name error in html/template. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5498045
2011-12-08update tree for new default type ruleRuss Cox
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5448091
2011-11-28strings: fix test outputChristopher Wedgwood
R=rsc, gri CC=golang-dev https://golang.org/cl/5445044
2011-11-23strings: Add ContainsAny and ContainsRune to correspond to IndexAny etc.Scott Lawrence
R=golang-dev, r CC=golang-dev https://golang.org/cl/5430046
2011-11-13various: avoid func compareRuss Cox
R=gri, r, bradfitz CC=golang-dev https://golang.org/cl/5371074
2011-11-08renaming_3: gofix -r go1pkgrename src/pkg/[m-z]*Rob Pike
R=rsc CC=golang-dev https://golang.org/cl/5345045
2011-11-03all: rename os.EOF to io.EOF in various non-code contextsVincent Vanackere
R=golang-dev, r CC=golang-dev https://golang.org/cl/5334050
2011-11-01src/pkg/[n-z]*: gofix -r error -force=errorRuss Cox
R=golang-dev, bsiegert, iant CC=golang-dev https://golang.org/cl/5294074
2011-10-25bytes, strings: use runeRuss Cox
Various rune-based APIs change. R=golang-dev, r CC=golang-dev https://golang.org/cl/5306044
2011-10-03strings: implement a faster byte->string ReplacerBrad Fitzpatrick
This implements a replacer for when all old strings are single bytes, but new values are not. BenchmarkHTMLEscapeNew 1000000 1090 ns/op BenchmarkHTMLEscapeOld 1000000 2049 ns/op R=rsc CC=golang-dev https://golang.org/cl/5176043
2011-10-03strings: implement a faster byte->byte ReplacerBrad Fitzpatrick
When all old & new string values are single bytes, byteReplacer is now used, instead of the generic algorithm. BenchmarkGenericMatch 10000 102519 ns/op BenchmarkByteByteMatch 1000000 2178 ns/op fast path, when nothing matches: BenchmarkByteByteNoMatch 1000000 1109 ns/op comparisons to multiple Replace calls: BenchmarkByteByteReplaces 100000 16164 ns/op comparison to strings.Map: BenchmarkByteByteMap 500000 5454 ns/op R=rsc CC=golang-dev https://golang.org/cl/5175050
2011-09-28strings: add Replacer, NewReplacerBrad Fitzpatrick
This is just a new API to do many replacements at once. While the point of this API is to be faster than doing replacements one at a time, the implementation in this CL has the optimizations removed and may actually be slower. Future CLs will bring back & add optimizations. R=r, rsc, rogpeppe CC=golang-dev https://golang.org/cl/5081042
2011-09-26bytes: add EqualFoldRuss Cox
R=golang-dev, r, r CC=golang-dev https://golang.org/cl/5123047
2011-09-26strings: add EqualFoldRuss Cox
Case-insensitive strcmp without using ToLower. (Using ToLower is not always correct, and it allocates.) R=golang-dev, r CC=golang-dev https://golang.org/cl/5143044
2011-07-14go/printer: changed max. number of newlines from 3 to 2Robert Griesemer
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go (cd src/cmd/gofix/testdata; gofmt -w *.in *.out) (cd src/pkg/go/printer; gotest -update) gofmt -w misc src runs all tests R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4715041
2011-06-28strings.Split: make the default to split all.Rob Pike
Change the signature of Split to have no count, assuming a full split, and rename the existing Split with a count to SplitN. Do the same to package bytes. Add a gofix module. R=adg, dsymonds, alex.brainman, rsc CC=golang-dev https://golang.org/cl/4661051
2011-06-22os.Error API: don't export os.ErrorString, use os.NewError consistentlyRobert Griesemer
This is a core API change. 1) gofix misc src 2) Manual adjustments to the following files under src/pkg: gob/decode.go rpc/client.go os/error.go io/io.go bufio/bufio.go http/request.go websocket/client.go as well as: src/cmd/gofix/testdata/*.go.in (reverted) test/fixedbugs/bug243.go 3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go) Compiles and runs all tests. R=r, rsc, gri CC=golang-dev https://golang.org/cl/4607052
2011-05-31http: have client set Content-Length when possibleBrad Fitzpatrick
Also some cleanup, removing redundant code. Make more things use NewRequest. Add some tests, docs. R=golang-dev, adg, rsc CC=golang-dev https://golang.org/cl/4561047
2011-05-26strings: implement UnreadByte, UnreadRuneRobert Griesemer
Added corresponding tests. R=rsc CC=golang-dev https://golang.org/cl/4560045
2011-05-15strings: make Reader.Read use copy instead of an explicit loop.Nigel Tao
R=r, bradfitz, r CC=golang-dev https://golang.org/cl/4529064
2011-04-20src/pkg: make package doc comments consistently start with "Package foo".Nigel Tao
R=rsc CC=golang-dev https://golang.org/cl/4442064
2011-03-29bytes, strings: simplify JoinEvan Shaw
R=gri, rsc CC=golang-dev https://golang.org/cl/4300044
2011-03-28strings: Map: avoid allocation when string is unchangedBrad Fitzpatrick
This speeds up strings.ToLower, etc. before/after: strings_test.BenchmarkMapNoChanges 1000000 1013 ns/op strings_test.BenchmarkMapNoChanges 5000000 442 ns/op R=r, rog, eh, rsc CC=golang-dev https://golang.org/cl/4306056
2011-03-25testing: shorten some tests.Rob Pike
These are the top runners. More to come. Also print two digits of timing info under -test.v. R=rsc CC=golang-dev https://golang.org/cl/4317044
2011-03-08strings: better benchmark names; add BenchmarkIndexBrad Fitzpatrick
R=dsymonds CC=golang-dev https://golang.org/cl/4264052
2011-03-08strings: add IndexRune tests, ASCII fast pathBrad Fitzpatrick
$ gotest -test.v -test.run=IndexRune -test.bench=.* === RUN strings_test.TestIndexRune --- PASS: strings_test.TestIndexRune (0.0 seconds) PASS strings_test.BenchmarkIndexRune 20000000 105 ns/op strings_test.BenchmarkIndexByte 50000000 48 ns/op R=rsc, dsymonds CC=golang-dev https://golang.org/cl/4267050
2011-01-04strings: fix description of FieldsFuncRoger Peppe
R=r CC=golang-dev https://golang.org/cl/3814041
2010-11-30utf8: make EncodeRune's destination the first argument.Adam Langley
R=r CC=golang-dev https://golang.org/cl/3364041
2010-11-12strings: add LastIndexAnyBenny Siegert
The need for a LastIndexAny function has come up in the discussion for https://golang.org/cl/3008041/. This function is implemented analogously to lastIndexFunc, using functions from the utf8 package. R=r, rsc, PeterGo CC=golang-dev https://golang.org/cl/3057041
2010-11-01strings: ContainsBrad Fitzpatrick
Tiny helper to avoid strings.Index(s, sub) != -1 R=rsc, r2, r CC=golang-dev https://golang.org/cl/2265044
2010-10-26use copyRuss Cox
R=gri CC=golang-dev https://golang.org/cl/2763041
2010-10-22gofmt -s -w src miscRobert Griesemer
R=r, rsc CC=golang-dev https://golang.org/cl/2662041
2010-09-23bytes, strings: change lastIndexFunc to use DecodeLastRuneRoger Peppe
R=r CC=golang-dev, rsc https://golang.org/cl/2271041
2010-09-21strings: fix minor bug in LastIndexFuncRoger Peppe
R=r, rsc CC=golang-dev https://golang.org/cl/2250042
2010-08-18build: no required environment variablesRuss Cox
R=adg, r, PeterGo CC=golang-dev https://golang.org/cl/1942044
2010-08-05bytes: add IndexRune, FieldsFunc and To*SpecialChristian Himpel
Basically these functions are implemented the same way as the corresponding functions in the strings package. Test functions are implemented for IndexRune and FieldsFunc. Additionally two typos are fixed in packages bytes and strings. R=r CC=golang-dev https://golang.org/cl/1696062
2010-08-03strings: fix Split("", "", -1)Scott Lawrence
Fixes #980. Made it return an empty array, rather than crash. Added relevant test cases to strings. R=golang-dev, r CC=golang-dev https://golang.org/cl/1914041
2010-07-27bytes, strings: mention the n < 0 case in Split/SplitAfter doc commentAndrew Gerrand
R=r, rsc CC=golang-dev https://golang.org/cl/1669055
2010-07-23bytes: port IndexFunc and LastIndexFunc from strings packageFazlul Shahriar
This CL basically applies the same changes as http://code.google.com/p/go/source/detail?r=5e0a29014e8e but for bytes package. R=r, rog CC=golang-dev https://golang.org/cl/1670052
2010-07-20strings: add TitleRob Pike
strings.ToTitle converts all characters to title case, which for consistency with the other To* functions it should continue to do. This CL adds string.Title, which does a proper title-casing of the string. A similar function for package bytes will follow once this is settled. Fixes #933. R=rsc CC=golang-dev https://golang.org/cl/1869042