MCPcopy Create free account
hub / github.com/microsoft/typescript-go / StripQuotes

Function StripQuotes

internal/stringutil/util.go:231–241  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

229}
230
231func StripQuotes(name string) string {
232 if len(name) < 2 {
233 return name
234 }
235 firstChar, _ := utf8.DecodeRuneInString(name)
236 lastChar, _ := utf8.DecodeLastRuneInString(name)
237 if firstChar == lastChar && (firstChar == '\'' || firstChar == '"' || firstChar == '`') {
238 return name[1 : len(name)-1]
239 }
240 return name
241}
242
243var matchSlashSomething = regexp.MustCompile(`\\.`)
244

Callers 7

createSearchMethod · 0.92
quoteFunction · 0.92
UnquoteStringFunction · 0.85

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected