Extend the power of Strings in Swift.
You can easily add as a requirement with SwiftPM.
Here are some quick copypastas for you
.package(url: "https://github.com/swiftpackages/SuperString.git", from: "1.0.0"),
.product(name: "SuperString", package: "SuperString"),
Your Package.swift
file should look something like this
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "SuperCoolProject",
products: [
.library(
name: "SuperCoolProject",
targets: ["SuperCoolProject"]),
],
dependencies: [
.package(url: "https://github.com/swiftpackages/SuperString.git", from: "1.0.0"),
],
targets: [
.target(
name: "SuperCoolProject",
dependencies: [
.product(name: "SuperString", package: "SuperString"),
]),
.testTarget(
name: "SuperCoolProject",
dependencies: ["SuperCoolProject"])
]
)
"ThisIs a Cool string".camelcased() // thisIsACoolString
"ThisIs a Cool string".camelcased(.upper) // ThisIsACoolString
"ThisIs a Cool string".pascalcased() // ThisIsACoolString
"ThisIs a Cool string".kebabcased() // this-is-a--cool-string
"ThisIs a Cool string".snakecased() // this_is_a__cool_string
You can find the full documentation on the documentation website.