Commit 790d844
[analyzer_utilities] Add String.toSnakeCase extension method.
This extension method complements the existing `toCamelCase` and
`toPascalCase` extension methods, allowing a string to be converted
from `camelCase` or `PascalCase` to `snake_case`.
This extension method will be useful in the analyzer diagnostic
message generation logic, which still uses a mix of case styles.
Note that there's no need for a separate method to convert to
`UPPER_SNAKE_CASE`; that can be easily done by calling `toUpperCase`
after `toSnakeCase`.
Change-Id: I6a6a69647f4ee176ecdbaefc3de0906a88c69079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460206
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Paul Berry <[email protected]>1 parent a6faf24 commit 790d844
File tree
2 files changed
+40
-0
lines changed- pkg/analyzer_utilities
- lib/extensions
- test/extensions
2 files changed
+40
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
54 | 78 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
0 commit comments