Scite Hexify |
|
此腳本將選取內容轉換至 C 中使用的轉譯十六進位形式。使用復原 (Undo) 來移除轉換後的文字。
例如「abc」->「\x61\x62\x63」、「���T�」使用拉丁語系-1 編碼 ->「\x8a\xe7\xef\x54\xca」、「���T�」使用 UTF-8 編碼 ->「\xc5\xa0\xc3\xa7\xc3\xaf\x54\xc3\x8a」。
-- Convert a string to a string of hex escapes function Hexify(s) local hexits = "" for i = 1, string.len(s) do hexits = hexits .. string.format("\\x%2x", string.byte(s, i)) end return hexits end -- Convert the selection to hex escaped form -- command.name.1.*=Hexify Selection -- command.mode.1.*=subsystem:lua,savebefore:no -- command.1.*=HexifySelection function HexifySelection() editor:ReplaceSel(Hexify(editor:GetSelText())) end