Hello, "Andres Perera" wrote:
> On Sun, Dec 12, 2010 at 11:35 PM, C K Kashyap <[email protected]> > wrote: > > > > I have a set of lines like this - > > > > char str1 = "hello"; > > char str2 = "printer"; > > > > and I'd like to generate - > > > > char str1 = "hello"; > > char str1_arr[5]; > > char str2 = "printer"; > > char str2_arr[7]; As your are writing in C, why aren't you directly writing: char str1[] = "hello"; The compiler will automatically have str1 contain 6 characters. Other solution (for a mapping): :s#char\s\+\(\S\+\)\s*=\s*"\(.*\)"\s*\zs;#\="\nchar ".submatch(1)."_arr[".len(submatch(2))."];"# (which will not count another character for the 0-terminal) -- Luc Hermitte http://lh-vim.googlecode.com/ http://hermitte.free.fr/vim/ -- 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
