Question about @FIELDS

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Of @FIELDS the docs say "If string is double quoted, you must specify sep_list."

But what would be the point of double quoting string? When it's double quoted, %FIELDS seems to always count it as **1** field:

Code:
v:\> echo %@words[".",".a.b.c."]
1

v:\> echo %@words[" "," a b c "]
1
Is that WAD?
 
#2
Of @FIELDS the docs say "If stringis double quoted, you must specify sep_list."

But what would be the point of double quoting string? When it's double quoted, %FIELDS seems to always count it as **1** field:

Code:
v:\> echo %@words[".",".a.b.c."]
1

v:\> echo %@words[" "," a b c "]
1
Is that WAD?
I misspoke/mis-tested. But it's the same with @FIELDS:

Code:
v:\> echo %@fields[" "," a b c "]
1

v:\> echo %@fields[".",".a.b.c."]
1
 

rconn

Administrator
Staff member
May 14, 2008
10,162
86
#3
vefatica wrote:

> Of @FIELDS the docs say "If *string*is double quoted, you must specify *sep_list*."
>
> But what would be the point of double quoting *string?* When it's double quoted, %FIELDS seems to always count it as **1** field:
>
>
> Code:
> ---------
> v:\> echo %@words[".",".a.b.c."]
> 1
>
> v:\> echo %@words[" "," a b c "]
> 1
> ---------
> Is that WAD?
Yes. Why are you (pointlessly) double quoting the string?

Rex Conn
JP Software
 
#4
On Wed, 15 Apr 2009 20:38:59 -0500, rconn <> wrote:

|vefatica wrote:
|
|
|---Quote---
|> Of @FIELDS the docs say "If *string*is double quoted, you must specify *sep_list*."
|>
|> But what would be the point of double quoting *string?* When it's double quoted, %FIELDS seems to always count it as **1** field:
|>
|>
|> Code:
|> ---------
|> v:\> echo %@words[".",".a.b.c."]
|> 1
|>
|> v:\> echo %@words[" "," a b c "]
|> 1
|> ---------
|> Is that WAD?
|---End Quote---
|Yes. Why are you (pointlessly) double quoting the string?

I should have been using @FIELD above (it behaves the same). I quoted the
string to try to preserve leading separators. How do I preserve leading
space-separators with @FIELDS? Why did you pointlessly say "If *string*is
double quoted, you must specify *sep_list*."? (Actually I know the answer to
that one.)
--
- Vince