Changeset 1954
- Timestamp:
- 09/04/10 15:23:54 (14 years ago)
- Files:
-
- trunk/docsrc/changelog.dd (modified) (1 diff)
- trunk/phobos/std/string.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docsrc/changelog.dd
r1953 r1954 42 42 $(LI $(BUGZILLA 4363): Some phobos ranges are not forward ranges (but should be).) 43 43 $(LI $(BUGZILLA 4381): Length attribute for std.typecons.Tuple.) 44 44 $(LI $(BUGZILLA 4387): std.range.Cycle assumes lvalue elements.) 45 45 $(LI $(BUGZILLA 4388): std.range.Radial assumes lvalue elements.) 46 46 $(LI $(BUGZILLA 4403): std.range.FrontTransversal assumes lvalue elements.) 47 47 $(LI $(BUGZILLA 4404): std.range.Transversal assumes lvalue elements.) 48 48 $(LI $(BUGZILLA 4455): Taking the sqrt of an integer shouldn't require an explicit cast.) 49 49 $(LI $(BUGZILLA 4464): std.range.take does not always return Take!R.) 50 50 $(LI $(BUGZILLA 4603): array(iota(1, 0)) error.) 51 51 $(LI $(BUGZILLA 4700): to!float("0") fails) 52 $(LI $(BUGZILLA 4748): Shadowing declaration error in std.string.tolower) 52 53 $(LI $(BUGZILLA 4789): std.algorithm.sort bug) 53 54 $(LI $(BUGZILLA 4810): dotProduct problem with ints) 54 55 ) 55 56 ) 56 57 57 58 58 59 <div id=version> 59 60 $(UL 60 61 $(NEW 049) 61 62 $(NEW 048) trunk/phobos/std/string.d
r1923 r1954 775 775 assert(i == 0); 776 776 } 777 777 778 778 779 779 /************************************ 780 780 * Convert string s[] to lower case. 781 781 */ 782 782 783 783 S tolower(S)(S s) if (isSomeString!S) 784 784 { 785 foreach (i, dchar c ; s)786 { 787 if (!std.uni.isUniUpper(c )) continue;785 foreach (i, dchar cOuter; s) 786 { 787 if (!std.uni.isUniUpper(cOuter)) continue; 788 788 auto result = s[0.. i].dup; 789 789 foreach (dchar c; s[i .. $]) 790 790 { 791 791 if (std.uni.isUniUpper(c)) 792 792 { 793 793 c = std.uni.toUniLower(c); 794 794 } 795 795 result ~= c; 796 796 } 797 797 return cast(S) result; … … 905 905 tolowerInPlace(s3); 906 906 assert(s3 == s2, s3); 907 907 908 908 s1 = "\u0130"; 909 909 s2 = tolower(s1); 910 910 s3 = s1.dup; 911 911 assert(s2 == "i"); 912 912 assert(s2 !is s1); 913 913 tolowerInPlace(s3); 914 914 assert(s3 == s2, s3); 915 916 // Test on wchar and dchar strings. 917 assert(tolower("Some String"w) == "some string"w); 918 assert(tolower("Some String"d) == "some string"d); 915 919 } 916 920 917 921 /************************************ 918 922 * Convert string s[] to upper case. 919 923 */ 920 924 921 925 S toupper(S)(S s) if (isSomeString!S) 922 926 { 923 927 alias typeof(s[0]) Char; 924 928 int changed;
