Skip to content

Commit d002862

Browse files
committed
update readme
1 parent 08ed123 commit d002862

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed

README.md

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,82 @@
1-
# string-case-swift
1+
StringCase
2+
=================================
3+
4+
[![Swift Package Manager](https://rawgit.com/jlyonsmith/artwork/master/SwiftPackageManager/swiftpackagemanager-compatible.svg)](https://swift.org/package-manager/)
5+
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/Digipolitan)
6+
7+
String extension to write camelCase string and snakeCase string
8+
9+
## Installation
10+
11+
### SPM
12+
13+
To install StringCase with SwiftPackageManager, add the following lines to your `Package.swift`.
14+
15+
```swift
16+
let package = Package(
17+
name: "XXX",
18+
products: [
19+
.library(
20+
name: "XXX",
21+
targets: ["XXX"]),
22+
],
23+
dependencies: [
24+
.package(url: "https://github.com/Digipolitan/string-case-swift.git", .branch("master"))
25+
],
26+
targets: [
27+
.target(
28+
name: "XXX",
29+
dependencies: ["StringCase"]),
30+
.testTarget(
31+
name: "XXXTests",
32+
dependencies: ["CommandLineArgs"])
33+
]
34+
)
35+
```
36+
37+
## The Basics
38+
39+
- CamelCase
40+
41+
Transform the current string to a camel case string as follow :
42+
43+
```swift
44+
let res = "i love swift".camelCased()
45+
print("\(res)") // Will print iLoveSwift
46+
```
47+
48+
```swift
49+
let res = " i love swift ".camelCased(.capitalized)
50+
print("\(res)") // Will print ILoveSwift
51+
```
52+
53+
- SnakeCase
54+
55+
Transform the current string to a snake case string as follow :
56+
57+
```swift
58+
let res = "i love swift".snakeCased()
59+
print("\(res)") // Will print i_love_swift
60+
```
61+
62+
```swift
63+
let res = "i_LOVE SWIFT".snakeCased()
64+
print("\(res)") // Will print i_love_swift
65+
```
66+
67+
```swift
68+
let res = " iLove Swift ".snakeCased(.upper)
69+
print("\(res)") // Will print I_LOVE_SWIFT
70+
```
71+
72+
## Contributing
73+
74+
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details!
75+
76+
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
77+
By participating, you are expected to uphold this code. Please report
78+
unacceptable behavior to [[email protected]](mailto:[email protected]).
79+
80+
## License
81+
82+
StringCase is licensed under the [BSD 3-Clause license](LICENSE).

Sources/StringCase/StringCase.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,3 @@ public extension String {
110110
return res
111111
}
112112
}
113-

0 commit comments

Comments
 (0)