Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Text To XML Safe StringNew to Visual Studio Code? Get it now.
Text To XML Safe String

Text To XML Safe String

gpng

|
626 installs
| (0) | Free
Formats text to XML safe string, replace linebreaks (\n), tabs (\t), and special characters
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

text-to-xml-safe-string README

Formats text to XML safe string, replace linebreaks (\n), tabs (\t), and special characters (&, ', ", <, >)

Installation

Published and distributed on the VSCode Marketplace

Features

  1. Select text that you want formatted
  2. Open command palette with cmd+shift+p (Mac) or ctrl+shift+p (Windows)
  3. Search and select command "Text To XML Safe String"
  4. The string will be inserted below your selection, wrapped in quotes for use in code

Example

Input:

sql.Exec(`
    SELECT * FROM some_table
    WHERE name = $1
`, "John Doe")

Output:

"sql.Exec(`\n\tSELECT * FROM some_table\n\tWHERE name = $1\n`, &#34;John Doe&#34;)"

TODO

  • Configuration option for wrapping output in quotes or other text

  • Output should be inserted after entire selection, not where the cursor ends the selection when select dragging

Contributing

Please contribute!

License

MIT © 2020 gpng

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft