Page 1 of 1 1
Topic Options
#121714 - 2004-06-23 01:41 PM ReadProfilestring with a blank
flipsgemp Offline
Lurker

Registered: 2004-06-23
Posts: 1
Hi everybody,

$listdrives = SPLIT(ReadProfileString($ficsit,$OuPart,""),CHR(10))
here is the code is use. It return an array with a space and the end of the array.
So my last instruction is on error.

Top
#121715 - 2004-06-23 02:13 PM Re: ReadProfilestring with a blank
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
H, and welcome to KORG. This is perfectly normal so no worries. Just have to perform a IF check during iteration, like this -

Code:

break on

for each $value in split(readprofilestring(".\t.ini","section",""),chr(10))
if $value
?"Value=" $Value
endif
next

exit 1



-Shawn

Top
#121716 - 2004-06-23 02:18 PM Re: ReadProfilestring with a blank
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

It return an array with a space and the end of the array.



Yes, it does

You may REDIM the array to remove the last (blank) entry:
Code:
Redim Preserve $listdrives[Ubound($listdrives)-1]



However most people just ignore the blank entry using something like:
Code:
$listdrives = SPLIT(ReadProfileString($ficsit,$OuPart,""),CHR(10)) 

For Each $drive in $listdrives
If $drive
...do something...
EndIf
Next



Edited by Richard H. (2004-06-23 02:19 PM)

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.15 seconds in which 0.088 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org