This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Creating variables out of database files

Old posts that have not been replied to for several years.
Locked
B
BiLL
Halfop
Posts: 78
Joined: Wed Sep 26, 2001 8:00 pm
Location: Germany

Creating variables out of database files

Post by BiLL »

Hi,

I got a little question:

I have a database file called db.txt.

In it are a few lines stored:

User1|Pass1
User2|Pass2
User3|Pass3
User4|Pass4

Now I want a proc which outputs me that file but I wanna strip of the | and make User1 and Pass1 a variable so I can modify the output style. Now the question is how must the "set $user ..." line looks so that it always takes text before the | and the rest is set to $pass ??
Would be nice if anyone could write me a short example proc. Thanks!!!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set user [lindex [split $yourline "|"] 0]
set pass [lindex [split $yourline "|"] 1]
Once the game is over, the king and the pawn go back in the same box.
B
BiLL
Halfop
Posts: 78
Joined: Wed Sep 26, 2001 8:00 pm
Location: Germany

Post by BiLL »

awesome - works perfect!
thanks!
Locked