Page 1 of 1 1
Topic Options
#119624 - 2004-05-14 09:34 PM How to reformat this array?
OnScoobySnacks Offline
Fresh Scripter

Registered: 2003-04-22
Posts: 7
Here goes...

I have a list.ini file that looks like this:
[Fruit]
Apples=2
Oranges=4
Peaches=3
Banannas=5

[Drinks]
Milk=2
Beer=12
OJ=1

I'm using this to read the above ini file:
$fruit1=ReadProfileString(list.ini,"Fruit","")

Now what I need is to take $fruit1 and reformat it to enclose each entry with a "'" and seperate each entry with a ",". I just can't get my mind around how to do it?

Any help would be greatly welcome'd.
_________________________
Doo'n it doggie style!

Top
#119625 - 2004-05-14 09:46 PM Re: How to reformat this array?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Untested but something like this should work.
Code:
for $i=0 to ubound($aFruit)

$aFruit[$i] = "'" + $aFruit[$i] + "'"
$i = 1 + $i
next
$sFruit = join($aFruit,",")

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#119626 - 2004-05-14 10:31 PM Re: How to reformat this array?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
this UDF may be of some help GetINI()

Code:

; fullpath to the list.ini
$file = "g:\kix\sandbox\list.ini"

$fruit1 = getini($file,"fruit")
for each $line in $fruit1
? $line
next





Edited by Bryce (2004-05-14 10:37 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.057 seconds in which 0.027 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