| View previous topic :: View next topic |
| Author |
Message |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Sat Feb 14, 2004 12:48 pm Post subject: Help with editing strings. |
|
|
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 |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Feb 14, 2004 12:54 pm Post subject: |
|
|
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 |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Sat Feb 14, 2004 1:37 pm Post subject: |
|
|
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 |
|
 |
|