MCPcopy Create free account
hub / github.com/cogentcore/core / ReCaseSelection

Method ReCaseSelection

texteditor/select.go:445–453  ·  view source on GitHub ↗

ReCaseSelection changes the case of the currently selected text. Returns the new text; empty if nothing selected.

(c strcase.Cases)

Source from the content-addressed store, hash-verified

443// ReCaseSelection changes the case of the currently selected text.
444// Returns the new text; empty if nothing selected.
445func (ed *Editor) ReCaseSelection(c strcase.Cases) string {
446 if !ed.HasSelection() {
447 return ""
448 }
449 sel := ed.Selection()
450 nstr := strcase.To(string(sel.ToBytes()), c)
451 ed.Buffer.ReplaceText(sel.Reg.Start, sel.Reg.End, sel.Reg.Start, nstr, EditSignal, ReplaceNoMatchCase)
452 return nstr
453}

Callers

nothing calls this directly

Calls 5

HasSelectionMethod · 0.95
SelectionMethod · 0.95
ToFunction · 0.92
ToBytesMethod · 0.80
ReplaceTextMethod · 0.45

Tested by

no test coverage detected