Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FYI - alines() with blank string
Message
From
04/08/2006 09:00:15
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01142943
Message ID:
01142952
Views:
10
>Hi everybody,
>
>lcTitle = ""
>lnLines = alines(laLines, m.lcTitle)
>
>lnLines = 1
>
>I would expect it to return 0. Anyway, once I found this out I put a special handling for empty cases.

Actually, I'd expect it to return 1. lcTitle is not empty, it contains 1 empty string.

What's more interesting is that if lcTitle contains "" + Chr(10) + "", the return is still 1, which intuitively seems wrong, but on looking at it longer, makes sense since the line feed becomes the 1st character (ie line 1). Similarly, you get back 2 if lcTitle is "" + chr(10) + "" + chr(10) + "".
Previous
Reply
Map
View

Click here to load this message in the networking platform