> Sorry but,
> Out of well indexing,
> which is faster ?
>
> 1) indexing by bytes -> legacy
> 2) indexing by characters -> vim9script
Indexing by bytes can be faster. But the difference is probably small,
the computation of the index probably matters more. You'll have to try
it out to know
> On 2023-06-03, Bram Moolenaar wrote:
> >
> >> Legacy Vim script:
> >>
> >> let text = 'àbc'
> >> echo text[2]
> >>
> >> Result: 'b'
> >>
> >> Vim 9 script:
> >>
> >> const text = 'àbc'
> >> echo text[2]
> >>
> >> Result: 'c'
> >>
> >> Is the different behavior (counting chars
Hi Bram,
Sorry but,
Out of well indexing,
which is faster ?
1) indexing by bytes -> legacy
2) indexing by characters -> vim9script
Thank you for your answer.
Nicolas
**
Le samedi 3 juin 2023 à 13:12:53 UTC+2, Bram Moolenaar a écrit :
>
> > Legacy Vim script:
> >
> > let text = 'àbc'
> > echo
On 2023-06-03, Lifepillar wrote:
>> Yes, in Vim9 script the index is in characters. In legacy script it is
>> in bytes.
>>
>> The help for this doesn't have it's own tag, I'll add one.
>> You can find it above ":help vim9-gotchas".
>
> I was expecting to find it under `:help vim9-differences`,
On 2023-06-03, Bram Moolenaar wrote:
>
>> Legacy Vim script:
>>
>> let text = 'àbc'
>> echo text[2]
>>
>> Result: 'b'
>>
>> Vim 9 script:
>>
>> const text = 'àbc'
>> echo text[2]
>>
>> Result: 'c'
>>
>> Is the different behavior (counting chars vs bytes?) intentional?
>
> Yes, in
> Legacy Vim script:
>
> let text = 'àbc'
> echo text[2]
>
> Result: 'b'
>
> Vim 9 script:
>
> const text = 'àbc'
> echo text[2]
>
> Result: 'c'
>
> Is the different behavior (counting chars vs bytes?) intentional?
Yes, in Vim9 script the index is in characters. In legacy
On 2023-06-03, Lifepillar wrote:
> On 2023-06-03, Lifepillar wrote:
> Mmh, even strpart(), which is supposed to count bytes, gives the same
> result:
Forget this: strpart() is fine. I have trouble just with indexing.
Life.
--
--
You received this message from the "vim_use" maillist.
Do
On 2023-06-03, Lifepillar wrote:
> Legacy Vim script:
>
> let text = 'àbc'
> echo text[2]
>
> Result: 'b'
>
> Vim 9 script:
>
> const text = 'àbc'
> echo text[2]
>
> Result: 'c'
>
> Is the different behavior (counting chars vs bytes?) intentional?
Mmh, even strpart(), which is
Legacy Vim script:
let text = 'àbc'
echo text[2]
Result: 'b'
Vim 9 script:
const text = 'àbc'
echo text[2]
Result: 'c'
Is the different behavior (counting chars vs bytes?) intentional?
Thanks,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not