#214118 - 2022-04-29 06:24 PM
Re: (NA) Re: Issue with Array not ignoring empty lines
[Re: Glenn Barnas]
|
ShaneEP
MM club member
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
I think we're all clear on what's going on, and why the extra trim/left is needed. The issue in my opinion is mostly lack of documentation. The guide simply says "If this parameter is empty, all key names in the section specified by section are returned".
(1) I wouldn't expect to have to split it by chr(10) going off just that text. Only way anyone would know, is to look at previous examples, or to display the return as a full string and guess if it's chr(10) or chr(13).
(2) I still wouldn't expect it to include the extra chr(10) at the end. This just adds the requirement of an additional unnecessary data massaging function in my opinion. No other enum functions return an extra element (I know those are arrays and not a string, but same concept).
As I stated above, I only suggest Left() over Trim() because if there happens to be an intentional space at the beginning or end of a key name (unlikely but possible), it would get trimmed off resulting in error. You could also do Left($string, Len($string)-1) if it makes you feel better. But not sure what you're referring to with the Left($string, -1) being a golf mechanism. The kix doc says "Specifying a negative value will cause Left to return the number of characters equal to the total length of the string minus the value specified". Nothing magical there. It is indeed clearly documented.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 370 anonymous users online.
|
|
|