Commit 1b4eff2
Add methods from dotnet#27912 (Flow System.Text.Rune through more APIs) (dotnet#117168)
* Add rune overloads
* Fix some compiler errors
* More compiler error fixes
* Even more compiler error fixes
* Fix more compiler errors
* Various improvements & add refs
* Fix validation in LastIndexOf
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix replace core usage
* Fix TextInfo ToLower/ToUpper with 2-char runes
* Optimize `char.Equals` for Ordinal StringComparison
* Add conditional compilation for SYSTEM_PRIVATE_CORLIB
* Add more conditional compilation for SYSTEM_PRIVATE_CORLIB
* Rename `r` to `value`
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356631203
* Replace static Equals with instance methods
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356644411
* Rename `r` to `value` in refs
* Fix ToLower & ToUpper bypassing invariant globalization check
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356686500
* Add newline between ToLower, ToUpper
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356689265
* Optimize TextWriter.Write(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356754641
* Optimize TextWriter.WriteLine(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356758251
* Change TextWriter.WriteAsync(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356777291
* Change TextWriter.WriteLineAsync(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356784926
* Remove unnecessary slices in ToLower(Rune) & ToUpper(Rune)
https://github.com/dotnet/runtime/pull/117168/files#r2356675263
* Revert `Split(char, options)`, `Split(char, int, options)` order
dotnet#117168 (comment)
* Flip Split(Rune, options) and Split(Rune, int, options) order
dotnet#117168 (comment)
* Make `Equals(char, StringComparison)` helper internal
dotnet#117168 (comment)
* Add `StringBuilder.EnumerateRunes()` & `StringBuilder.RuneEnumerator`
* Make `IndexOf`/`LastIndexOf` overload helpers internal
* Fix WriteLineAsync(Rune)
dotnet#117168 (comment)
* Rename left/right local variables to old/new
dotnet#117168 (comment)
* Remove unnecessary `else`
dotnet#117168 (comment)
* Move StringBuilder.RuneEnumerator -> StringBuilderRuneEnumerator
dotnet#117168 (comment)
* Add `ArgumentOutOfRangeException.ThrowIfNegative(index);`
dotnet#117168 (comment)
* Replace exception with ThrowHelper.ThrowIndexOutOfRangeException();
dotnet#117168 (comment)
* Add empty line between StringBuilder.Replace overloads
dotnet#117168 (comment)
* Add doc comments to all added APIs
dotnet#117168 (comment)
* Use invariant culture for string.Replace(Rune, Rune)
dotnet#117168 (comment)
* Reference `StringBuilderRuneEnumerator.cs` file
* Update exceptions in string builder GetRuneAt
* Change string.Replace(Rune, Rune) compare options from None to Ordinal
* Use span comparison for StartsWith/EndsWith
* Make sure start index not bypassed in string.Trim(Rune)
* Fix incorrect slice end index
* Replace IndexOf & LastIndexOf code with span conversion
* Add `Contains_Rune` and `Contains_Rune_StringComparison` tests
* Add string.Split tests
* Add string.IndexOf & string.LastIndexOf tests
* Add string.Replace tests
* Fix string.Replace tests
* Add string.EndsWith tests
* Add string.StartsWith tests
* Fix bounds check in TrimStart(Rune)
* Fix bounds check in Trim(Rune)
* Simplify string.Empty to Empty
* Use AsSpan helper method to simplify rune to span
* Document ordinal comparisons
* Fix IndexOf/LastIndexOf startIndex
* Add Trim Rune tests
* Add StringBuilder test to EnumerateRunes test
* Separate EnumerateRunes tests for string & StringBuilder
* Add Rune.Equals(Rune, StringComparison) test
* Add StringBuilder Append Rune test
* Add StringBuilder GetRuneAt/TryGetRuneAt tests
* Add StringBuilder Insert_Rune and Insert_Rune_Invalid tests
* Use consistent style with other tests
* Add StringBuilder ReplaceRune tests
* Add TextWriter rune tests
* Add TextInfo ToLower/ToUpper tests
* Add rune tests to SplitCharSeparator
* Fix sub index not offsetted in IndexOf/LastIndexOf
* Fix LastIndexOf searchIndex
* Fix LastIndexOf
* Remove `#if SYSTEM_PRIVATE_CORLIB`
* Change code style for rune trimming
* Fix error in new code style
* Fix `Rune` not found in `TextInfoTests.cs`
* Fix incorrect method name in `TextWriterTests`
* Fix incorrect StartsWith Rune test
* Fix tests with Rune attribute arguments
* Fix `str` -> `value`
* Fix concatenating rune array
* Add dedicated `SplitRuneSeparator` test
* Fix trim rune tests
* Fix invalid collection expressions in tests
* Fix InsertRune test
* Fix replace rune tests
* Fix unused comparisonType parameter
* Fix index of test names
* Remove redundant test
* Fix missing using
* Fix replace method called with string comparison argument
* Fix tried to test split with rune on span
* Remove start index from LastIndexOf tests
* Remove non-existent comparisonType parameter
* Fix StartsWith test incorrect call
* Fix LastIndexOf behaviour
* Various rune test fixes
* Fix error in LastIndexOf test
* Some fixes and ensure the Runtime tests passes
* Add brackets to ternary condition
* Rename `runeSeparator` to `separatorSpan`
* Add rune overloads
* Fix some compiler errors
* More compiler error fixes
* Even more compiler error fixes
* Fix more compiler errors
* Various improvements & add refs
* Fix validation in LastIndexOf
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix replace core usage
* Fix TextInfo ToLower/ToUpper with 2-char runes
* Optimize `char.Equals` for Ordinal StringComparison
* Add conditional compilation for SYSTEM_PRIVATE_CORLIB
* Add more conditional compilation for SYSTEM_PRIVATE_CORLIB
* Rename `r` to `value`
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356631203
* Replace static Equals with instance methods
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356644411
* Rename `r` to `value` in refs
* Fix ToLower & ToUpper bypassing invariant globalization check
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356686500
* Add newline between ToLower, ToUpper
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356689265
* Optimize TextWriter.Write(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356754641
* Optimize TextWriter.WriteLine(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356758251
* Change TextWriter.WriteAsync(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356777291
* Change TextWriter.WriteLineAsync(Rune)
https://github.com/dotnet/runtime/pull/117168/files/663459d5b1ab973657d22e5cce43c02477386fbe#r2356784926
* Remove unnecessary slices in ToLower(Rune) & ToUpper(Rune)
https://github.com/dotnet/runtime/pull/117168/files#r2356675263
* Revert `Split(char, options)`, `Split(char, int, options)` order
dotnet#117168 (comment)
* Flip Split(Rune, options) and Split(Rune, int, options) order
dotnet#117168 (comment)
* Make `Equals(char, StringComparison)` helper internal
dotnet#117168 (comment)
* Add `StringBuilder.EnumerateRunes()` & `StringBuilder.RuneEnumerator`
* Make `IndexOf`/`LastIndexOf` overload helpers internal
* Fix WriteLineAsync(Rune)
dotnet#117168 (comment)
* Rename left/right local variables to old/new
dotnet#117168 (comment)
* Remove unnecessary `else`
dotnet#117168 (comment)
* Move StringBuilder.RuneEnumerator -> StringBuilderRuneEnumerator
dotnet#117168 (comment)
* Add `ArgumentOutOfRangeException.ThrowIfNegative(index);`
dotnet#117168 (comment)
* Replace exception with ThrowHelper.ThrowIndexOutOfRangeException();
dotnet#117168 (comment)
* Add empty line between StringBuilder.Replace overloads
dotnet#117168 (comment)
* Add doc comments to all added APIs
dotnet#117168 (comment)
* Use invariant culture for string.Replace(Rune, Rune)
dotnet#117168 (comment)
* Reference `StringBuilderRuneEnumerator.cs` file
* Update exceptions in string builder GetRuneAt
* Change string.Replace(Rune, Rune) compare options from None to Ordinal
* Use span comparison for StartsWith/EndsWith
* Make sure start index not bypassed in string.Trim(Rune)
* Fix incorrect slice end index
* Replace IndexOf & LastIndexOf code with span conversion
* Add `Contains_Rune` and `Contains_Rune_StringComparison` tests
* Add string.Split tests
* Add string.IndexOf & string.LastIndexOf tests
* Add string.Replace tests
* Fix string.Replace tests
* Add string.EndsWith tests
* Add string.StartsWith tests
* Fix bounds check in TrimStart(Rune)
* Fix bounds check in Trim(Rune)
* Simplify string.Empty to Empty
* Use AsSpan helper method to simplify rune to span
* Document ordinal comparisons
* Fix IndexOf/LastIndexOf startIndex
* Add Trim Rune tests
* Add StringBuilder test to EnumerateRunes test
* Separate EnumerateRunes tests for string & StringBuilder
* Add Rune.Equals(Rune, StringComparison) test
* Add StringBuilder Append Rune test
* Add StringBuilder GetRuneAt/TryGetRuneAt tests
* Add StringBuilder Insert_Rune and Insert_Rune_Invalid tests
* Use consistent style with other tests
* Add StringBuilder ReplaceRune tests
* Add TextWriter rune tests
* Add TextInfo ToLower/ToUpper tests
* Add rune tests to SplitCharSeparator
* Fix sub index not offsetted in IndexOf/LastIndexOf
* Fix LastIndexOf searchIndex
* Fix LastIndexOf
* Remove `#if SYSTEM_PRIVATE_CORLIB`
* Change code style for rune trimming
* Fix error in new code style
* Fix `Rune` not found in `TextInfoTests.cs`
* Fix incorrect method name in `TextWriterTests`
* Fix incorrect StartsWith Rune test
* Fix tests with Rune attribute arguments
* Fix `str` -> `value`
* Fix concatenating rune array
* Add dedicated `SplitRuneSeparator` test
* Fix trim rune tests
* Fix invalid collection expressions in tests
* Fix InsertRune test
* Fix replace rune tests
* Fix unused comparisonType parameter
* Fix index of test names
* Remove redundant test
* Fix missing using
* Fix replace method called with string comparison argument
* Fix tried to test split with rune on span
* Remove start index from LastIndexOf tests
* Remove non-existent comparisonType parameter
* Fix StartsWith test incorrect call
* Fix LastIndexOf behaviour
* Various rune test fixes
* Some fixes and ensure the Runtime tests passes
* Add brackets to ternary condition
* Rename `runeSeparator` to `separatorSpan`
* Final fixes touches.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Co-authored-by: Tarek Mahmoud Sayed <tarekms@microsoft.com>
Co-authored-by: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com>1 parent 7430c6d commit 1b4eff2
18 files changed
Lines changed: 1602 additions & 6 deletions
File tree
- src/libraries
- System.Private.CoreLib/src
- System
- Globalization
- IO
- Text
- System.Runtime
- ref
- tests
- System.Globalization.Tests/System/Globalization
- System.IO.Tests
- TestDataProvider
- TextWriter
- System.Runtime.Tests/System
- Text
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1217 | 1217 | | |
1218 | 1218 | | |
1219 | 1219 | | |
| 1220 | + | |
1220 | 1221 | | |
1221 | 1222 | | |
1222 | 1223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
| |||
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
183 | 194 | | |
184 | 195 | | |
185 | 196 | | |
| |||
451 | 462 | | |
452 | 463 | | |
453 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
454 | 476 | | |
455 | 477 | | |
456 | 478 | | |
| |||
461 | 483 | | |
462 | 484 | | |
463 | 485 | | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
464 | 530 | | |
465 | 531 | | |
466 | 532 | | |
| |||
Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
128 | 145 | | |
129 | 146 | | |
130 | 147 | | |
| |||
343 | 360 | | |
344 | 361 | | |
345 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
346 | 383 | | |
347 | 384 | | |
348 | 385 | | |
| |||
542 | 579 | | |
543 | 580 | | |
544 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
545 | 604 | | |
546 | 605 | | |
547 | 606 | | |
| |||
605 | 664 | | |
606 | 665 | | |
607 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
608 | 689 | | |
609 | 690 | | |
610 | 691 | | |
| |||
Lines changed: 77 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
589 | 590 | | |
590 | 591 | | |
591 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
592 | 631 | | |
593 | 632 | | |
594 | 633 | | |
| |||
1162 | 1201 | | |
1163 | 1202 | | |
1164 | 1203 | | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
1165 | 1242 | | |
1166 | 1243 | | |
1167 | 1244 | | |
| |||
0 commit comments