LoginSignup
2
0

More than 3 years have passed since last update.

ダブルクオートなどの特殊文字をエスケープするサービスを公開しました

Last updated at Posted at 2019-06-01

概要

javaなどでシングルクオート、ダブルクオートなどを文字列として認識させるときにシングルクオート、ダブルクオートにバックスラッシュをつけたり、改行を改行コードに修正するのって面倒ですよね。

テストデータを作るときとか必要なのですが、私は今まですごく面倒でした。

便利なサービスはないかなと思って探したのですが、案外、見つからなかったので、自作して公開してみました。
javascriptで組んでいるだけのシンプルなサービスです。

サイトURL

スクリーンショット 2019-06-01 11.36.47.png

変換表

文字 エスケープ
改行 \n
タブ \t
ダブルクオート \"
シングルクオート \'

サンプル

変換前

rowNum = int(input())

for i in range(rowNum):
    inputs = input()
    if inputs == "[]":
        inputs = []
    else:
        inputs = inputs.rstrip().split(' ')
        inputs = list(map(float, inputs))

    print(check_sample(inputs))

変換後

rowNum = int(input())\n\nfor i in range(rowNum):\n    inputs = input()\n    if inputs == \"[]\":\n        inputs = []\n    else:\n        inputs = inputs.rstrip().split(\' \')\n        inputs = list(map(float, inputs))\n\n    print(check_sample(inputs))
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0