summaryrefslogtreecommitdiff
path: root/src/pkg/strings
AgeCommit message (Collapse)AuthorFilesLines
2014-06-19Imported Upstream version 1.3upstream/1.3Michael Stapelberg5-34/+138
2013-12-03Imported Upstream version 1.2upstream/1.2Michael Stapelberg6-14/+62
2013-05-14Imported Upstream version 1.1upstream/1.1Michael Stapelberg2-3/+25
2013-03-04Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304Michael Stapelberg10-172/+1228
2012-06-14Imported Upstream version 1.0.2upstream/1.0.2Ondřej Surý1-1/+0
2012-04-06Imported Upstream version 1upstream/1Ondřej Surý9-212/+1124
2011-09-13Imported Upstream version 60upstream/60Ondřej Surý4-0/+1615
2011-09-13Imported Upstream version 60Ondřej Surý4-1619/+0
2011-08-03Imported Upstream version 59upstream/59Ondřej Surý3-13/+39
2011-06-30Imported Upstream version 58upstream/58Ondřej Surý2-23/+117
2011-04-28Imported Upstream version 2011.04.27upstream/2011.04.27Ondřej Surý1-1/+1
2011-04-26Imported Upstream version 2011.04.13upstream/2011.04.13Ondřej Surý2-22/+113
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý3-283/+358
2010-07-01strings and bytes.Split: make count of 0 mean 0, not infinite.Rob Pike2-36/+49
Use a count of -1 for infinity. Ditto for Replace. R=rsc CC=golang-dev http://codereview.appspot.com/1704044 Committer: Rob Pike <r@golang.org>
2010-06-30bytes, strings: add ReplaceRuss Cox2-0/+84
This is the Replace I suggested in the review of CL 1114041. It's true that we already have regexp.MustCompile(regexp.QuoteMeta(old)).ReplaceAll(s, new) but because this Replace is doing a simpler job it is simpler to call and inherently more efficient. I will add the bytes implementation and tests to the CL after the strings one has been reviewed. R=r, cw CC=golang-dev http://codereview.appspot.com/1731048
2010-06-14Add IndexFunc and LastIndexFunc.Roger Peppe2-36/+187
Change TrimRight and TrimLeft to use these functions. Incidentally fix minor bug in TrimRight. Add some test cases for this. YMMV whether it's worth saving the closure allocation. R=r, r2 CC=golang-dev, hoisie, rsc http://codereview.appspot.com/1198044 Committer: Rob Pike <r@golang.org>
2010-05-05Conversion from loop to copy().Kyle Consalus1-3/+1
R=golang-dev, gri CC=golang-dev http://codereview.appspot.com/1072041 Committer: Robert Griesemer <gri@golang.org>
2010-04-20strings: add ReadRune to ReaderKyle Consalus2-2/+48
R=rsc CC=golang-dev http://codereview.appspot.com/940041 Committer: Russ Cox <rsc@golang.org>
2010-04-19Added strings.FieldsFunc, a generalization of strings.Fields in style of the ↵Kyle Consalus2-2/+25
strings.Trim*Func functions. R=golang-dev, r CC=golang-dev http://codereview.appspot.com/824051 Committer: Rob Pike <r@golang.org>
2010-04-09strings: add IndexRune, Trim, TrimLeft, TrimRight, and the generic ↵Michael Hoisie2-11/+139
equivalents TrimFunc, TrimLeftFunc, TrimRightFunc R=rsc, r CC=golang-dev http://codereview.appspot.com/799048 Committer: Russ Cox <rsc@golang.org>
2010-03-30Unicode: provide an ability to supplement the case-mapping tablesRob Pike2-0/+40
in character and string case mapping routines. Add a custom mapper for Turkish and Azeri. A more general solution for deriving the case information from Unicode's SpecialCasing.txt will require more work. Fixes issue 703. R=rsc, rsc1 CC=golang-dev, mdakin http://codereview.appspot.com/824043
2010-03-29strings.FIelds: slight simplification.Rob Pike1-4/+5
R=rsc CC=golang-dev http://codereview.appspot.com/833042
2010-03-26bytes, strings: IndexOfAnyRobert Griesemer2-3/+31
+ first use in go/doc R=r CC=golang-dev http://codereview.appspot.com/781041
2010-03-04strings: make Split(s, "", n) fasterSpring Mc1-17/+24
R=rsc CC=golang-dev http://codereview.appspot.com/223096 Committer: Russ Cox <rsc@golang.org>
2010-02-25strings: delete Runes, BytesRuss Cox2-23/+3
gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench delete unused imports R=r CC=golang-dev http://codereview.appspot.com/224062
2010-02-25strings: remove a couple of redundant testsRobert Griesemer1-2/+4
(per suggestion from Heresy.Mc@gmail.com) R=rsc CC=golang-dev http://codereview.appspot.com/223052
2009-12-15bytes, strings: add new function FieldsAndrey Mirtchovski2-0/+64
R=rsc, r, phf CC=golang-dev http://codereview.appspot.com/170046 Committer: Russ Cox <rsc@golang.org>
2009-12-151) Change default gofmt default settings forRobert Griesemer3-172/+172
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 4th set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180049
2009-12-11bytes, strings: allow -1 in Map to mean "drop this character".Kei Son2-13/+29
xml: drop invalid characters in attribute names when constructing struct field names. R=rsc CC=r http://codereview.appspot.com/157104 Committer: Russ Cox <rsc@golang.org>
2009-12-02Runes: turn string into []intPeter Froehlich2-1/+57
Split: fixed typo in documentation R=rsc, r, r1 http://codereview.appspot.com/157170 Committer: Russ Cox <rsc@golang.org>
2009-11-30Typo in comment.Robert Griesemer1-1/+1
Fixes issue 358. R=rsc CC=r http://codereview.appspot.com/164043
2009-11-23go: makes it build for the case $GOROOT has whitespacesSergio Luis O. B. Correia1-2/+2
the bash scripts and makefiles for building go didn't take into account the fact $GOROOT / $GOBIN could both be directories containing whitespaces, and was not possible to build it in such a situation. this commit adjusts the various makefiles/scripts to make it aware of that possibility, and now it builds successfully when using a path with whitespaces as well. Fixes issue 115. R=rsc, dsymonds1 http://codereview.appspot.com/157067 Committer: Russ Cox <rsc@golang.org>
2009-11-20gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkgRuss Cox2-5/+5
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
2009-11-18add bytes.IndexByte; common case we can make fast later.Rob Pike2-0/+27
also pick off the special case in strings.Index. don't want strings.IndexByte because the call site will very rarely need to allocate and we can handle the test in the code itself. bytes.IndexByte can avoid a common allocation. R=rsc CC=golang-dev http://codereview.appspot.com/156091
2009-11-16 An asked-for-in #go-nuts extension to quickly create a repeatedDavid G. Andersen2-0/+39
copy of a string or a byte array. strings.Repeat("-", 50) bytes.Repeat(b, 99) R=rsc http://codereview.appspot.com/155063 Committer: Russ Cox <rsc@golang.org>
2009-11-15fix bug in bytes.Map and add test cases for Map in both strings and bytes ↵Rob Pike1-0/+27
packages. thanks to ulrik.sverdrup for the test case. Fixes issue 191. R=rsc CC=golang-dev http://codereview.appspot.com/155056
2009-11-09- replaced gofmt expression formatting algorithm withRobert Griesemer2-14/+14
rsc's algorithm - applied gofmt -w misc src - partial CL (last chunk) R=rsc, r http://go/go-review/1024041
2009-11-09remove semis after statements in one-statement statement listsRobert Griesemer3-41/+41
R=rsc, r http://go/go-review/1025029
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer3-30/+10
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
2009-11-05gofmt-ify strings, templateRobert Griesemer2-60/+56
R=r http://go/go-review/1018064
2009-11-04bytes.SplitAfter and strings.SplitAfterRuss Cox2-5/+48
most common usage is: lines := strings.SplitAfter(text, "\n", 0) R=r http://go/go-review/1018042
2009-10-12fix comment on strings.LastIndex.Russ Cox3-1/+42
add bytes.LastIndex. add strings.Reader. R=r DELTA=59 (56 added, 0 deleted, 3 changed) OCL=35585 CL=35601
2009-10-10change Title to ToTitle for consistency. (the doc comment was already right)Rob Pike1-1/+1
R=rsc DELTA=1 (0 added, 0 deleted, 1 changed) OCL=35572 CL=35572
2009-10-07apply gofmt to rand reflect regexp rpc runtime sort strconv strings sync ↵Russ Cox1-53/+61
syscall testing time unicode unsafe utf8 R=gri DELTA=1409 (79 added, 24 deleted, 1306 changed) OCL=35415 CL=35437
2009-09-21move strings.Buffer into bytesRob Pike3-575/+0
delete strings.Buffer add a test for a bug not caught before (mustn't install zero-length blocks) R=rsc DELTA=987 (289 added, 587 deleted, 111 changed) OCL=34850 CL=34850
2009-09-21step 2 of the great buffer shift.Rob Pike2-61/+273
make strings.Buffer handle strings and bytes with comparable efficiency. if ok, next step will be to move this code to bytes.Buffer and terminate strings.Buffer's short happy life. R=rsc DELTA=292 (212 added, 0 deleted, 80 changed) OCL=34837 CL=34849
2009-09-16first cut at a string buffer.Rob Pike3-0/+363
can be made more efficient but this is reasonable. R=rsc DELTA=363 (363 added, 0 deleted, 0 changed) OCL=34720 CL=34720
2009-09-15more "declared and not used".Russ Cox2-9/+11
the last round omitted := range and only checked 1 out of N vars in a multi-var := R=r OCL=34624 CL=34638
2009-09-01casing operations for byte arraysRob Pike1-4/+4
R=rsc DELTA=186 (181 added, 0 deleted, 5 changed) OCL=34203 CL=34203
2009-09-01make ToUpper, ToLower etc. handle unicode properly.Rob Pike2-59/+174
Change their names too. R=rsc DELTA=206 (123 added, 2 deleted, 81 changed) OCL=34170 CL=34194