Filename: Private: No Yes Filetype: Auto ABAP Sophia Apex Azure CLI Batch Bicep C Cameligo Clojure CoffeeScript C++ C# CSP CSS Cypher Dart Dockerfile ECL Elixir Flow9 FreeMarker2 FreeMarker2 (Angle/Bracket) FreeMarker2 (Angle/Dollar) FreeMarker2 (Auto/Bracket) FreeMarker2 (Auto/Dollar) FreeMarker2 (Bracket/Bracket) FreeMarker2 (Bracket/Dollar) F# Go GraphQL Handlebars Terraform HTML Ini Java JavaScript Julia Kotlin Less Lexon Liquid Lua Modula-3 Markdown MDX MIPS DAX MySQL Objective-C Pascal Pascaligo Perl PostgreSQL PHP Plain text ATS PQ PowerShell Protobuf Pug Python Q# R Razor Redis Redshift ReStructuredText Ruby Rust Small Basic Scala Scheme Sass Shell Solidity SPARQL SQL StructuredText Swift SV Tcl Twig TypeScript TypeSpec Visual Basic V WebGPU Shading Language XML YAML Indentation: Spaces Tabs 1 2 3 4 5 6 7 8 Clone package stringutil import ( "regexp" "strconv" "strings" ) // LeadingIdentRegExp ... var LeadingIdentRegExp = regexp.MustCompile("[\r\n]*([ \t]+)") // FormatQuery ... func FormatQuery(s string) string { result := "" insideStringApos := false insideStringQuot := false prevSpace := false s = strings.Trim(s, " \t\r\n") for _, ch := range s { switch ch { case '\'': prevSpace = false if !insideStringQuot { insideStringApos = !insideStringApos } result += string(ch) case '"': prevSpace = false if !insideStringApos { insideStringQuot = !insideStringQuot } result += string(ch) case ' ': fallthrough case ' ': fallthrough case '\n': if prevSpace { continue } if !insideStringApos && !insideStringQuot { prevSpace = true result += " " } else { result += string(ch) } default: prevSpace = false result += string(ch) } } return result } // ParseInt ... func ParseInt(x interface{}) int { switch x := x.(type) { case int: return x case int16: return int(x) case uint16: return int(x) case int32: return int(x) case uint32: return int(x) case int64: return int(x) case uint64: return int(x) case string: i, err := strconv.ParseInt(x, 0, 64) if err == nil { return int(i) } } return 0 } Paste