Charles E Campbell Jr schrieb: > Nikolai Weibull wrote: > >> On 9/19/07, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote: >> >>> let x='grĂ¼n' >>> echo "strlen(x)=".strlen(x) >>> >>> Thus, strlen() returns 5, not 4 as one might (sometimes) expect. >>> >>> >> Here's what I have in one my base library: >> >> function now#mbc#len(str) >> return strlen(substitute(a:str, '.', 'c', 'g')) >> endfunction >> >> Which is incredibly much better than your solution ;-). >> >> > Well, I came up with another solution, but it still isn't as good as > yours! Shouldn't strlen() just handle this on its own? With C or C++, > one may be wanting to use the output of strlen() to help with allocating > memory to hold a string; I don't see any of that application with Vim. > > Regards, > Chip Campbell
The multibyte strlen() is even suggested/documented here: :h strlen() -- Andy --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---