forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Convert table LIST into a line

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Gosha_Mala
Newbie


Joined: 14 Apr 2009
Posts: 2

PostPosted: Tue Apr 14, 2009 1:21 pm    Post subject: Convert table LIST into a line Reply with quote

Hi,

I'm a beginer in VDS scripting and run out of ideas of how to solve a simple problem. I have a simple table list like:

John;
Paul;
George;
Ringo;

What would be the best way to convert it to a line?

John;Paul;George;Ringo;

Thank you.
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Tue Apr 14, 2009 2:20 pm    Post subject: Reply with quote

Hi Gosha_Mala.
Wellcome to VDS.

You can read every table item and put them into a variable.
You can try this:

Code:
  %%linevar =
  list seek,list1,0
  repeat
    %a = @next(list1)
    if %a
      %%linevar = %%linevar%a
    end
  until @null(%a)


Wink Good luck
_______________

uVeDeSe
_______________

visit: http://www.uvedese.es
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Apr 14, 2009 5:04 pm    Post subject: Reply with quote

Yup, what he said up there. Smile
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Gosha_Mala
Newbie


Joined: 14 Apr 2009
Posts: 2

PostPosted: Wed Apr 15, 2009 5:14 am    Post subject: Reply with quote

uvedese,

Thank you very much! Smile
Back to top
View user's profile Send private message
JerryDee
Contributor
Contributor


Joined: 19 Oct 2005
Posts: 53
Location: Czech Republic

PostPosted: Wed Apr 15, 2009 9:35 am    Post subject: Reply with quote

Hi Gosha_Mala!

For your task you can also use right this function: @text(list)


e.g.

Code:

list create,1
list loadtext,1
"John;
"Paul;
"George;
"Ringo;

%%linevar = @text(1)

list close,1
exit


Smile

_________________
Jerry
(VDS 4,5,6 Pro | V-Setup 3)
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Apr 15, 2009 3:58 pm    Post subject: Reply with quote

@text() will not pull it all into a single line though.
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
JerryDee
Contributor
Contributor


Joined: 19 Oct 2005
Posts: 53
Location: Czech Republic

PostPosted: Wed Apr 15, 2009 5:10 pm    Post subject: Reply with quote

Oh, I'm sorry - you are right, Garret, I looked at it only in "debug window" and was hasty Embarassed
_________________
Jerry
(VDS 4,5,6 Pro | V-Setup 3)
Back to top
View user's profile Send private message Send e-mail
JerryDee
Contributor
Contributor


Joined: 19 Oct 2005
Posts: 53
Location: Czech Republic

PostPosted: Wed Apr 15, 2009 5:47 pm    Post subject: Reply with quote

O.K. - my another attempt Smile
Code:

# The @strrep() is accepted only for VDS6
list create,1
list loadtext,1
"John;
"Paul;
"George;
"Ringo;

%%linevar = @strrep(@text(1),@cr()@chr(10),"",ALL)
info %%linevar

list close,1
exit


Edit: This my "custom-function" works pretty well but in a final effect is much slower - so it can serve only as a little (funny) exhibition of using of a new vds function

_________________
Jerry
(VDS 4,5,6 Pro | V-Setup 3)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group