| View previous topic :: View next topic |
| Author |
Message |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 5:19 pm Post subject: String replace? |
|
|
I'm having some problems.
I couldn't find help in the help file but this might have been discussed here before.
Anyways, I want to replace the " " (space) with the letter "+" in a single string. How can I do this? _________________
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 10:28 pm Post subject: |
|
|
Thanks for the reply.
I'm really new at VDS and that was kinda way over my head at the moment
Isn't there a simple stringreplace command in VDS? If not, it should be
Anyways, I'll try to figure something out  _________________
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Feb 19, 2003 10:33 pm Post subject: |
|
|
Nope, there's no straightforward S&R in VDS. Could be one for the wish list, though.
If you don't wanna do it the more complicated way in pure VDS, then there are
a couple of DLL's which can help you:
VDSXFN
and
VDSSTR (in the VDSDLL3 package)
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 10:38 pm Post subject: |
|
|
OK, I'll have a look at those.
Thanks  _________________
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 10:55 pm Post subject: |
|
|
Just downloaded and tried Vdsxfn.dll and it has just what I needed.
Thanks for the tip  _________________
 |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Thu Feb 20, 2003 1:05 am Post subject: |
|
|
The following code will only work for VDS 4 and up.
| Code: |
%%search = " "
%%replace = "+"
%%source = "This is a test sentence."
repeat
%p = @pos(%%search,%%source)
if @greater(%p,0)
%%source = @strdel(%%source,%p)
%%source = @strins(%%source,%p,%%replace)
end
until @zero(%p)
|
Hope this helps.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Feb 20, 2003 4:59 am Post subject: |
|
|
Worked great.
Thanks alot bweckel  _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 20, 2003 5:22 am Post subject: |
|
|
| bweckel wrote: | The following code will only work for VDS 4 and up.
|
Hey Bill,
Actually, that code works in VDS3 as well...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Feb 20, 2003 5:08 pm Post subject: |
|
|
| If you want to use plain VDS code, you could also take a look at my website: http://www.skit3000.tk/ In the VDS section you can find a piece of code called "VDS String", which has got a lot of string manipulate functions like those in the DLL Dr. Dread mentioned... |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Feb 20, 2003 5:31 pm Post subject: |
|
|
Yeah, nice code. Your site was one of the first one I looked at when I started VDS about 4-5 days ago  _________________
 |
|
| Back to top |
|
 |
|