From 516c99682f2d8a47cf8693069ac67715270aeb27 Mon Sep 17 00:00:00 2001 From: Naveen Mahalingam Date: Thu, 14 Mar 2024 10:35:56 -0700 Subject: [PATCH] text: AlignAuto uses strconv.ParseFloat instead of RegExp --- text/align.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text/align.go b/text/align.go index 1cce7ec..c11b511 100644 --- a/text/align.go +++ b/text/align.go @@ -36,7 +36,8 @@ var ( func (a Align) Apply(text string, maxLength int) string { aComputed := a if aComputed == AlignAuto { - if reNumericText.MatchString(text) { + _, err := strconv.ParseFloat(text, 64) + if err == nil { // was able to parse a number out of the string aComputed = AlignRight } else { aComputed = AlignLeft