Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chanced committed Aug 30, 2022
2 parents 60c8cf8 + 921be6c commit 6110203
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 34 deletions.
16 changes: 8 additions & 8 deletions caps.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (ti TokenizerImpl) Tokenize(str string, allowedSymbols []rune, numberRules
} else {
current = token.AppendRune(ti.caser, current, r)
}
} else if ti.delimiters.Contains(r) {
} else if ti.delimiters.Contains(r) || unicode.IsSpace(r) {
if current.Len() > 0 {
if foundLower {
tokens = append(tokens, current)
Expand Down Expand Up @@ -746,20 +746,20 @@ func ToScreamingKebab[T ~string](str T, options ...Opts) T {
return ToDelimited(str, '-', false, options...)
}

// ToDot transforms the case of str into Lower Dot Notation Case (e.g. an.example.string) using
// ToDotNotation transforms the case of str into Lower Dot Notation Case (e.g. an.example.string) using
// either the provided Converter or the DefaultConverter otherwise.
//
// caps.ToDot("This is [an] {example}${id32}.") // this.is.an.example.id.32
func ToDot[T ~string](str T, options ...Opts) T {
// caps.ToDotNotation("This is [an] {example}${id32}.") // this.is.an.example.id.32
func ToDotNotation[T ~string](str T, options ...Opts) T {
return ToDelimited(str, '.', true, options...)
}

// ToScreamingKebab transforms the case of str into Screaming Kebab Case (e.g.
// AN-EXAMPLE-STRING) using either the provided Converter or the
// ToScreamingDotNotation transforms the case of str into Screaming Kebab Case (e.g.
// AN.EXAMPLE.STRING) using either the provided Converter or the
// DefaultConverter otherwise.
//
// caps.ToScreamingDot("This is [an] {example}${id32}.") // THIS.IS.AN.EXAMPLE.ID.32
func ToScreamingDot[T ~string](str T, options ...Opts) T {
// caps.ToScreamingDotNotation("This is [an] {example}${id32}.") // THIS.IS.AN.EXAMPLE.ID.32
func ToScreamingDotNotation[T ~string](str T, options ...Opts) T {
return ToDelimited(str, '.', false, options...)
}

Expand Down
4 changes: 2 additions & 2 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ func ExampleToScreamingKebab() {
}

func ExampleToDotNotation() {
fmt.Println(caps.ToScreamingDot("This is [an] {example}${id32}."))
fmt.Println(caps.ToDotNotation("This is [an] {example}${id32}."))
// Output:
// this.is.an.example.id.32
}

func ExampleToScreamingDotNotation() {
fmt.Println(caps.ToScreamingDot("This is [an] {example}${id32}."))
fmt.Println(caps.ToScreamingDotNotation("This is [an] {example}${id32}."))
// Output:
// THIS.IS.AN.EXAMPLE.ID.32
}
Expand Down
Loading

0 comments on commit 6110203

Please sign in to comment.