We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9ca1e4e commit 3f75f81Copy full SHA for 3f75f81
text/text.go
@@ -521,6 +521,11 @@ func (t Text) ToValidUTF8(replacement Text) Text {
521
return Text(strings.ToValidUTF8(t.String(), replacement.String()))
522
}
523
524
+// Pointer returns a pointer to t.
525
+func Pointer(t Text) *Text {
526
+ return &t
527
+}
528
+
529
func collect(slice []string) Texts {
530
res := make([]Text, len(slice))
531
for i, v := range slice {
text/text_test.go
@@ -1454,3 +1454,10 @@ func TestText_ToValidUTF8(t *testing.T) {
1454
})
1455
1456
1457
1458
+func TestPointer(t *testing.T) {
1459
+ x := Text("abc")
1460
+ if Pointer(x).String() != x.String() {
1461
+ t.Error("Pointer failed")
1462
+ }
1463
0 commit comments