Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Question about @FIELDS

May
12,846
164
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?
 
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
 
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
 
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
 

Similar threads

Back
Top