Skip to content

proposal: strings: add StripSlashes like PHP stripslashes #43579

@LockGit

Description

@LockGit

Provide a new function, like any other language, function can Un-quotes a quoted string.

Describe:
Returns a string with backslashes stripped off. (' becomes ' and so on.)
Double backslashes (\) are made into a single backslash ().

For example:

fmt.Println(StripSlashes(`\\\\1`))  
// will print  "\\1"

other language function like: https://www.php.net/manual/en/function.stripslashes.php

See pull request:
#43492

Relates to the proposal:
https://go-review.googlesource.com/c/go/+/281372

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions