{"action":"created","issue":{"url":"https://api.github.com/repos/fdorg/flashdevelop/issues/601","labels_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/601/labels{/name}","comments_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/601/comments","events_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/601/events","html_url":"https://github.com/fdorg/flashdevelop/issues/601","id":59340466,"number":601,"title":"Add \"Escape String\" command to scintilla","user":{"login":"hgupta9","id":6797866,"avatar_url":"https://avatars.githubusercontent.com/u/6797866?v=3","gravatar_id":"","url":"https://api.github.com/users/hgupta9","html_url":"https://github.com/hgupta9","followers_url":"https://api.github.com/users/hgupta9/followers","following_url":"https://api.github.com/users/hgupta9/following{/other_user}","gists_url":"https://api.github.com/users/hgupta9/gists{/gist_id}","starred_url":"https://api.github.com/users/hgupta9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgupta9/subscriptions","organizations_url":"https://api.github.com/users/hgupta9/orgs","repos_url":"https://api.github.com/users/hgupta9/repos","events_url":"https://api.github.com/users/hgupta9/events{/privacy}","received_events_url":"https://api.github.com/users/hgupta9/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-28T12:41:20Z","updated_at":"2015-03-20T22:09:48Z","closed_at":"2015-03-20T22:09:48Z","body":"How often have you manually escaped a string? (ie. changed the \"\\\" to \"\\\\\" so it compiles OK?). I am requesting a command, to be added to the scintilla context menu, for \"Escape String\".\r\n\r\nHere is the code to perform the actual escaping, can this please be added as a command into FD4?\r\n\r\n\r\n\t// List of escape sequences\r\n\tprivate static string[] CS_EscapeSequences = new string[] { \"\\aa\", \"\\bb\", \"\\ff\", \"\\nn\", \"\\rr\", \"\\tt\", \"\\vv\", \"\\\"\\\"\", \"\\\\\\\\\", \"??\", \"\\00\" };\r\n\r\n\tprivate static char[] CS_EscapeTable;\r\n\r\n\tprivate static bool EscapeCSInited = false;\r\n\r\n\t\r\n\t/// <summary>\r\n\t/// Convert the string to the escaped string literal\r\n\t/// </summary>\r\n\tpublic static string EscapeString(this string str) {\r\n\r\n\t\tif (EscapeCSInited == false) {\r\n\t\t\tEscapeCSInited = true;\r\n\t\t\tCS_EscapeTable = new char[256];\r\n\t\t\tforeach (string escape in CS_EscapeSequences) {\r\n\t\t\t\tCS_EscapeTable[escape[0]] = escape[1];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (str == null) return \"null\";\r\n\r\n\t\tStringBuilder sb = new StringBuilder(str.Length + 2);\r\n\r\n\t\tfor (int rp = 0; rp < str.Length; rp++) {\r\n\t\t\tchar c = str[rp];\r\n\r\n\t\t\t// if it is an escape char\r\n\t\t\tif (c <= 255 && CS_EscapeTable[c] != '\\0') {\r\n\r\n\t\t\t\t// ASCII escaped character\r\n\t\t\t\tsb.Append('\\\\').Append(CS_EscapeTable[c]);\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// ASCII printable character\r\n\t\t\t\tsb.Append(c);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn sb.ToString();\r\n\t}"},"comment":{"url":"https://api.github.com/repos/fdorg/flashdevelop/issues/comments/84166920","html_url":"https://github.com/fdorg/flashdevelop/issues/601#issuecomment-84166920","issue_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/601","id":84166920,"user":{"login":"Meychi","id":2213937,"avatar_url":"https://avatars.githubusercontent.com/u/2213937?v=3","gravatar_id":"","url":"https://api.github.com/users/Meychi","html_url":"https://github.com/Meychi","followers_url":"https://api.github.com/users/Meychi/followers","following_url":"https://api.github.com/users/Meychi/following{/other_user}","gists_url":"https://api.github.com/users/Meychi/gists{/gist_id}","starred_url":"https://api.github.com/users/Meychi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Meychi/subscriptions","organizations_url":"https://api.github.com/users/Meychi/orgs","repos_url":"https://api.github.com/users/Meychi/repos","events_url":"https://api.github.com/users/Meychi/events{/privacy}","received_events_url":"https://api.github.com/users/Meychi/received_events","type":"User","site_admin":false},"created_at":"2015-03-20T22:09:48Z","updated_at":"2015-03-20T22:09:48Z","body":"Macro is easily shareable and i think this is not so common task."}}