I was thinking the other way. If !IsPrint() then strconv.Quote() > On Oct 13, 2021, at 6:24 PM, Tim Hockin <thoc...@google.com> wrote: > > > ` IsPrint(r) || r == '\\' || r == '"' ` passes tests. I need to build > confidence in that, though :) Thanks. > >> On Wed, Oct 13, 2021 at 4:16 PM Robert Engels <reng...@ix.netcom.com> wrote: >> A simple loop calling IsPrint is your best bet. You could then have a custom >> implementation of Quote that started at a specified index. >> >>> On Oct 13, 2021, at 5:46 PM, 'Tim Hockin' via golang-nuts >>> <golang-nuts@googlegroups.com> wrote: >>> >>> Is there any ready-built function that can tell me whether >>> `strconv.Quote()` would produce a different string than its input, without >>> actually running it? Or is there a clearly documented set of rules one >>> could use to test each rune in a string? >>> >>> I am trying to avoid allocations, and MOST of the inputs will be safe (but >>> not all). Calling strconv.Quote() has a measurable impact, so I'd avoid it >>> if I could... >>> >>> Does such an animal exist? >>> >>> Tim >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to golang-nuts+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/1bb3f806-5930-4866-8249-0bbc0ee383b8n%40googlegroups.com.
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/A27DF12D-BFB7-4841-8113-69AF70C4BDB1%40ix.netcom.com.