Skip to content

Commit 325a368

Browse files
committed
docs: update examples
1 parent 37a277c commit 325a368

File tree

71 files changed

+240
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+240
-240
lines changed

README.md

Lines changed: 80 additions & 80 deletions

examples/index/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// Index returns the rune index of the first occurrence of sub, or -1 if not found.
1313

1414
// Example: first rune index
15-
v := str.Of("héllo")
16-
godump.Dump(v.Index("llo"))
15+
v := str.Of("héllo").Index("llo")
16+
godump.Dump(v)
1717
// #int 2
1818
}

examples/isempty/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// IsEmpty reports whether the string has zero length.
1313

1414
// Example: empty check
15-
v := str.Of("")
16-
godump.Dump(v.IsEmpty())
15+
v := str.Of("").IsEmpty()
16+
godump.Dump(v)
1717
// #bool true
1818
}

examples/join/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// Join joins the provided words with sep.
1313

1414
// Example: join words
15-
v := str.Of("unused")
16-
godump.Dump(v.Join([]string{"foo", "bar"}, "-").String())
15+
v := str.Of("unused").Join([]string{"foo", "bar"}, "-").String()
16+
godump.Dump(v)
1717
// #string foo-bar
1818
}

examples/kebab/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// Kebab converts the string to kebab-case.
1313

1414
// Example: kebab case
15-
v := str.Of("fooBar baz")
16-
godump.Dump(v.Kebab().String())
15+
v := str.Of("fooBar baz").Kebab().String()
16+
godump.Dump(v)
1717
// #string foo-bar-baz
1818
}

examples/lastindex/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// LastIndex returns the rune index of the last occurrence of sub, or -1 if not found.
1313

1414
// Example: last rune index
15-
v := str.Of("go gophers go")
16-
godump.Dump(v.LastIndex("go"))
15+
v := str.Of("go gophers go").LastIndex("go")
16+
godump.Dump(v)
1717
// #int 10
1818
}

examples/lastword/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// LastWord returns the last word token or empty string.
1313

1414
// Example: last word
15-
v := str.Of("Hello world")
16-
godump.Dump(v.LastWord().String())
15+
v := str.Of("Hello world").LastWord().String()
16+
godump.Dump(v)
1717
// #string world
1818
}

examples/lcfirst/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ func main() {
1313

1414
// Example: lowercase first rune
1515
v := str.Of("Gopher")
16-
godump.Dump(v.LcFirst().String())
16+
godump.Dump(v)
1717
// #string gopher
1818
}

examples/limit/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// Limit truncates the string to length runes, appending suffix if truncation occurs.
1313

1414
// Example: limit with suffix
15-
v := str.Of("Perfectly balanced, as all things should be.")
16-
godump.Dump(v.Limit(10, "...").String())
15+
v := str.Of("Perfectly balanced, as all things should be.").Limit(10, "...").String()
16+
godump.Dump(v)
1717
// #string Perfectly...
1818
}

examples/padboth/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// PadBoth pads the string on both sides to reach length runes using pad (defaults to space).
1313

1414
// Example: pad both
15-
v := str.Of("go")
16-
godump.Dump(v.PadBoth(6, "-").String())
15+
v := str.Of("go").PadBoth(6, "-").String()
16+
godump.Dump(v)
1717
// #string --go--
1818
}

0 commit comments

Comments
 (0)