MCPcopy
hub / github.com/pocketbase/pocketbase / Sentenize

Function Sentenize

tools/inflector/inflector.go:29–43  ·  view source on GitHub ↗

Sentenize converts and normalizes string into a sentence.

(str string)

Source from the content-addressed store, hash-verified

27
28// Sentenize converts and normalizes string into a sentence.
29func Sentenize(str string) string {
30 str = strings.TrimSpace(str)
31 if str == "" {
32 return ""
33 }
34
35 str = UcFirst(str)
36
37 lastChar := str[len(str)-1:]
38 if lastChar != "." && lastChar != "?" && lastChar != "!" {
39 return str + "."
40 }
41
42 return str
43}
44
45// Sanitize sanitizes `str` by removing all characters satisfying `removePattern`.
46// Returns an error if the pattern is not valid regex string.

Callers 3

TestSentenizeFunction · 0.92
NewApiErrorFunction · 0.92
resolveSafeErrorItemFunction · 0.92

Calls 1

UcFirstFunction · 0.85

Tested by 1

TestSentenizeFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…