Wednesday, January 25, 2017

idx-edx: Different Character count in Vim and Python

Example:

s="I like crème caramel but not only caramel I also like crème fraîche."

Searching the idx-edx numbers of the matches of the word "crème":
echo matchstrpos(s, "crème") --> 7,13
echo matchstrpos(s, "crème",14) --> 55,61

I do have a python function in which I transform the above string using slices.
But the problem is that in python accented letters are counted as 1
and in Vim as 2, my slicing goes wrong.

How can I resolve this problem?

--
--
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: