@@ -10,69 +10,23 @@ A simple Go library for string case conversion. Converts between camelCase, Pasc
1010go get github.com/gomantics/sx
1111```
1212
13- ## Usage
13+ ## Documentation
1414
15- ``` go
16- package main
17-
18- import (
19- " fmt"
20-
21- " github.com/gomantics/sx"
22- )
23-
24- func main () {
25- // Convert to different cases
26- fmt.Println (sx.CamelCase (" hello-world" )) // helloWorld
27- fmt.Println (sx.PascalCase (" hello_world" )) // HelloWorld
28- fmt.Println (sx.KebabCase (" HelloWorld" )) // hello-world
29- fmt.Println (sx.SnakeCase (" HelloWorld" )) // hello_world
30- fmt.Println (sx.TrainCase (" hello-world" )) // Hello-World
31- fmt.Println (sx.FlatCase (" hello-world" )) // helloworld
32-
33- // Works with mixed separators and cases
34- fmt.Println (sx.CamelCase (" mixed_caseWith-different.separators" )) // mixedCaseWithDifferentSeparators
35-
36- // Handle complex acronyms
37- fmt.Println (sx.KebabCase (" XMLHttpRequest" )) // xml-http-request
38- fmt.Println (sx.CamelCase (" HTML5Parser" , sx.WithNormalize (true ))) // html5Parser
39- }
40- ```
15+ For complete documentation, usage examples, and API reference, visit:
4116
42- ## Case Functions
17+ ** https://gomantics.dev/sx **
4318
44- - ` CamelCase() ` - converts to camelCase
45- - ` PascalCase() ` - converts to PascalCase
46- - ` KebabCase() ` - converts to kebab-case
47- - ` SnakeCase() ` - converts to snake_case
48- - ` TrainCase() ` - converts to Train-Case
49- - ` FlatCase() ` - converts to flatcase (no separators)
50-
51- ## Utilities
52-
53- - ` SplitByCase() ` - splits strings into words by case changes and separators
54- - ` UpperFirst() ` - capitalizes first character
55- - ` LowerFirst() ` - lowercases first character
56-
57- ## Options
58-
59- Some functions support options for customization:
19+ ## Quick Example
6020
6121``` go
62- // Normalize case for strict PascalCase/camelCase
63- sx.PascalCase (" XMLHttpRequest" , sx.WithNormalize (true )) // XmlHttpRequest
22+ import " github.com/gomantics/sx"
6423
65- // Custom separators for splitting
66- sx.SplitByCase (" hello.world" , sx.WithSeparators (' .' )) // ["hello", "world"]
67-
68- // Custom separator for kebab case
69- sx.KebabCase (" hello world" , " |" ) // hello|world
24+ sx.CamelCase (" hello-world" ) // helloWorld
25+ sx.PascalCase (" hello_world" ) // HelloWorld
26+ sx.KebabCase (" HelloWorld" ) // hello-world
27+ sx.SnakeCase (" HelloWorld" ) // hello_world
7028```
7129
72- ## Contributing
73-
74- Contributors are always welcome! Feel free to raise a PR or create an issue first.
75-
7630## Acknowledgements
7731
7832This library is highly inspired by [ scule] ( https://github.com/unjs/scule ) - a fantastic JavaScript string case utility library by the UnJS team.
0 commit comments