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 


Help with editing strings.

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


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Sat Feb 14, 2004 12:48 pm    Post subject: Help with editing strings. Reply with quote

Can some one help me find a way to change string like this;

Code:
127.0.0.1        SOMEHOST.com


notice the 8 spaces, I need to convert that into;

Code:
127.0.0.1   SOMEHOST.com


only 3 spaces.

Im using VDS4.
The first bit of the string 127.0.0.1 always stays the same.

Thank you
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Feb 14, 2004 12:54 pm    Post subject: Reply with quote

First of all: I've added the [ code ] tag to your post, so that people could see the spaces. For your problem, you could use this. I have not tested it, so if something of a string is missing (the first or last character), please say it and I will adjust the code.

Code:
%%String = 127.0.0.1        SOMEHOST.com

%%TempIP = @trim(@substr(@trim(%%String),1,@pos(" ",@trim(%%String))))
%%TempHost = @trim(@substr(@trim(%%String),@pos(" ",@trim(%%String)),@len(@trim(%%String))))
%%String = %%TempIP"   "%%TempHost

info %%String

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Sat Feb 14, 2004 1:37 pm    Post subject: Reply with quote

Or you could parse it:

Code:

option fieldsep," "
%%string = "127.0.0.1        SOMEHOST.com"
parse "%A;%B",%%string
%%newstring = %A"   "%B

info %%newstring


Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
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