Hi David!

On Mo, 07 Mai 2012, David Fishburn wrote:

> On 07/05/2012 2:17 PM, Christian Brabandt wrote:
> >Hi David!
> >
> >On Mo, 07 Mai 2012, David Fishburn wrote:
> >
> >>Vim 7.3.1-514
> >>
> >>iskeyword contains values like this:
> >>
> >>  38,47-58,-
> >>
> >>I can use nr2char(38) to get&.
> >>- can be used as itself.
> >>
> >>How can I expand the range of characters 47-58 to be it's equivalent:
> >>/, 0,1,2,3,4,5,6,7,8,9,:
> >>
> >>I was hoping to do something like this:
> >>for item in expand(split('47-58', '-'), '', 1)
> >>     " Somehow check if this is a regular character
> >>     if strtrans(nr2char(item)) != ''
> >>     endif
> >>endfor
> >>
> >>To iterate through each one.
> >>
> >>>echo range(47, 58)
> >>[47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]
> >>>echo range(split('47-58', '-')
> >echo map(range(47,58), 'nr2char(v:val)')
> >
> Thanks, the problem here is I have to go from here:
> "47-58"
> 
> to here:
> range( 47,58)
> 
> I was hoping to do it with a simple function call (split, join, ...)
> rather than parsing the text myself.

The problem is, range() does not take a list as argument. I could write 
a patch for that, but it still might take a while, until Bram includes 
it.
But this should work:
let r = split('46-58', '-')
echo range(r[0], r[1])

regards,
Christian
-- 
Warum überquerte das Huhn die Straße?
Captain James T. Kirk:
  Um dahin zu gehen, wo noch kein Huhn vorher war.

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

Reply via email to