Skip to content

Commit 4167d33

Browse files
committed
Include all casing functions in README.md
1 parent e1a7f0b commit 4167d33

File tree

1 file changed

+63
-39
lines changed

1 file changed

+63
-39
lines changed

README.md

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,37 @@
1212

1313
## Introduction
1414

15-
Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of strings. It has no third-party dependencies and supports Unicode.
15+
Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of
16+
strings. It has no third-party dependencies and supports Unicode.
1617

1718
<br>
1819

1920
## Installation
2021

21-
The latest release can be installed using [pip](https://pypi.org/project/casefy/):
22+
The latest release can be installed using
23+
[pip](https://pypi.org/project/casefy/):
24+
2225
```shell
2326
pip install -U casefy
2427
```
2528

26-
Casefy is also [available](https://aur.archlinux.org/packages/python-casefy) as an Arch Linux AUR package.
29+
Casefy is also [available](https://aur.archlinux.org/packages/python-casefy) as
30+
an Arch Linux AUR package.
2731

2832
<br>
2933

3034
## Examples
3135

32-
Note: for more details, you can check the [API Reference](https://dmlls.github.io/python-casefy/api.html).
36+
Note: for more details, you can check the [API
37+
Reference](https://dmlls.github.io/python-casefy/api.html).
3338

3439
```python
3540
import casefy
3641

42+
# Alphanum3ric case (removes non-alphanumeric chars)
43+
string = casefy.alphanumcase("foo - 123 ; bar!")
44+
print(string) # foo123bar
45+
3746
# camelCase
3847
string = casefy.camelcase("foo_bar")
3948
print(string) # fooBar
@@ -44,62 +53,61 @@ print(string) # fooBar
4453
string = casefy.camelcase("FOO BAR")
4554
print(string) # fooBar
4655

47-
48-
# PascalCase
49-
string = casefy.pascalcase("foo_bar")
50-
print(string) # FooBar
51-
52-
string = casefy.pascalcase("fooBar")
56+
# Capital Case
57+
string = casefy.capitalcase("fooBar")
5358
print(string) # FooBar
5459

55-
56-
# snake_case
57-
string = casefy.snakecase("fooBar")
58-
print(string) # foo_bar
59-
60-
string = casefy.snakecase("fooBARbaz", keep_together=["bar"])
61-
print(string) # foo_bar_baz
62-
63-
string = casefy.snakecase("FOO BAR")
64-
print(string) # foo_bar
65-
66-
6760
# CONST_CASE
6861
string = casefy.constcase("fooBar")
6962
print(string) # FOO_BAR
7063

71-
7264
# kebab-case
7365
string = casefy.kebabcase("fooBar")
7466
print(string) # foo-bar
7567

68+
# lowercase
69+
string = casefy.lowercase("fooBar")
70+
print(string) # foobar
7671

77-
# UPPER-KEBAB-CASE
78-
string = casefy.upperkebabcase("fooBar")
79-
print(string) # FOO-BAR
72+
# PascalCase
73+
string = casefy.pascalcase("foo_bar")
74+
print(string) # FooBar
8075

76+
string = casefy.pascalcase("fooBar")
77+
print(string) # FooBar
8178

82-
# separator case
79+
# Sentence case
80+
string = casefy.sentencecase("fooBar")
81+
print(string) # Foo bar
82+
83+
# Separator case
8384
string = casefy.separatorcase("fooBar", separator="/")
8485
print(string) # foo/bar
8586

8687
string = casefy.separatorcase("fooBARbaz", separator="%", keep_together=["bar"])
8788
print(string) # foo%bar%baz
8889

90+
# snake_case
91+
string = casefy.snakecase("fooBar")
92+
print(string) # foo_bar
8993

90-
# Sentence case
91-
string = casefy.sentencecase("fooBar")
92-
print(string) # Foo bar
94+
string = casefy.snakecase("fooBARbaz", keep_together=["bar"])
95+
print(string) # foo_bar_baz
9396

97+
string = casefy.snakecase("FOO BAR")
98+
print(string) # foo_bar
9499

95100
# Title Case
96-
string = casefy.titlecase("fooBar")
97-
print(string) # Foo Bar
101+
string = casefy.titlecase("fooBarBaz")
102+
print(string) # Foo Bar Baz
98103

104+
# UPPERCASE
105+
string = casefy.uppercase("fooBar")
106+
print(string) # FOOBAR
99107

100-
# Alphanum3ric case (removes non-alphanumeric chars)
101-
string = casefy.alphanumcase("foo - 123 ; bar!")
102-
print(string) # foo123bar
108+
# UPPER-KEBAB-CASE
109+
string = casefy.upperkebabcase("fooBar")
110+
print(string) # FOO-BAR
103111
```
104112

105113
<br>
@@ -111,17 +119,33 @@ If you find a bug, please open an issue. Pull Requests are also welcome!
111119

112120
## Acknowledgements
113121

114-
This project started when I saw that the package [`python-stringcase`](https://aur.archlinux.org/pkgbase/python-stringcase) was flagged-out-of-date in the Arch AUR Repository. The project [stringcase](https://github.com/okunishinishi/python-stringcase) seems not to be actively maintained anymore, so I decided to address its issues and pull requests and solve them in this new package. I kept the API as similar as possible, in order to facilitate any possible migration. I thank [Taka Okunishi](https://github.com/okunishinishi) (author of stringcase) and its contributors for their work.
122+
This project started when I saw that the package
123+
[`python-stringcase`](https://aur.archlinux.org/pkgbase/python-stringcase) was
124+
flagged-out-of-date in the Arch AUR Repository. The project
125+
[stringcase](https://github.com/okunishinishi/python-stringcase) seems not to be
126+
actively maintained anymore, so I decided to address its issues and pull
127+
requests and solve them in this new package. I kept the API as similar as
128+
possible, in order to facilitate any possible migration. I thank [Taka
129+
Okunishi](https://github.com/okunishinishi) (author of stringcase) and its
130+
contributors for their work.
115131

116132
<br>
117133

118134
## Related projects
119135

120-
- [`case-conversion`](https://github.com/AlejandroFrias/case-conversion) offers a very similar functionality as this project. I probably wouldn't have written this package if I had known of it before. However, the code of Casefy is more lightweight and just enough for most cases. If you need more functionality, e.g., detecting the case of a string, go with `case-conversion`.
136+
- [`case-conversion`](https://github.com/AlejandroFrias/case-conversion) offers
137+
a very similar functionality as this project. I probably wouldn't have written
138+
this package if I had known of it before. However, the code of Casefy is more
139+
lightweight and just enough for most cases. If you need more functionality,
140+
e.g., detecting the case of a string, go with `case-conversion`.
121141

122-
- [Inflection](https://github.com/jpvanhal/inflection) presents some overlap with this project as well, allowing the transformation of strings from CamelCase to underscored_string, but also singularizing and pluralizing English words.
142+
- [Inflection](https://github.com/jpvanhal/inflection) presents some overlap
143+
with this project as well, allowing the transformation of strings from
144+
CamelCase to underscored_string, but also singularizing and pluralizing
145+
English words.
123146

124147
<br>
125148

126149
## License
127-
Casefy is distributed under the [MIT](https://github.com/dmlls/python-casefy/blob/main/LICENSE) license.
150+
Casefy is distributed under the
151+
[MIT](https://github.com/dmlls/python-casefy/blob/main/LICENSE) license.

0 commit comments

Comments
 (0)