123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- let s:cpo_save=&cpo
- set cpo&vim
-
-
- " Function: lh#encoding#iconv(expr, from, to) " {{{3
-
-
- function! lh#encoding#iconv(expr, from, to)
- " call Dfunc("s:ICONV(
- if has('multi_byte') &&
- \ ( has('iconv') || has('iconv/dyn') ||
- \ ((a:from=~'latin1\|utf-8') && (a:to=~'latin1\|utf-8')))
- " call confirm('encoding: '.&enc."\nto:".a:to, "&Ok
- " call Dret("s:ICONV convert=
- return iconv(a:expr,a:from,a:to)
- else
-
- " call Dret("s:ICONV no convert=
- return a:expr
- endif
- endfunction
-
-
- " Function: lh#encoding#at(mb_string, i) " {{{3
-
-
-
- function! lh#encoding#at(mb_string, i)
- return matchstr(a:mb_string, '.', 0, a:i+1)
- endfunction
-
- " Function: lh#encoding#strpart(mb_string, pos, length) " {{{3
-
-
-
-
- function! lh#encoding#strpart(mb_string, p, l)
- return matchstr(a:mb_string, '.\{'.a:l.'}', 0, a:p+1)
- endfunction
-
- " Function: lh#encoding#strlen(mb_string) " {{{3
-
- function! lh#encoding#strlen(mb_string)
- return strlen(substitute(a:mb_string, '.', 'a', 'g'))
- endfunction
-
- let &cpo=s:cpo_save
-
|