Saturday, March 25, 2017

Re: Translate \u0041 to A

On Saturday, March 25, 2017 at 9:32:11 PM UTC+11, Christian Brabandt wrote:
>> A\u0042C\u0044E
>>
>> What substitute changes it to:
>>
>> ABCDE
>
> Something like this:
> :%s/\\u\(\x\{4\}\)/\=nr2char('0x'.submatch(1),1)/g
>
> or with a function like this:
>
> func! String(match)
> exe 'return "'.a:match.'"'
> endfunc
>
> And then:
> :%s/\\u\x\{4\}/\=String(submatch(0))/g

Thanks, I started well but got entirely lost.

John

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment