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 


String replace?

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


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 5:19 pm    Post subject: String replace? Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


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

PostPosted: Wed Feb 19, 2003 10:13 pm    Post subject: Reply with quote

I did some search & replace routines some time ago. Try to look here:
http://www.vdsworld.com/forum/viewtopic.php?t=690

That might take ya a step further

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
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 10:28 pm    Post subject: Reply with quote

Thanks for the reply.
I'm really new at VDS and that was kinda way over my head at the moment Embarassed

Isn't there a simple stringreplace command in VDS? If not, it should be Smile

Anyways, I'll try to figure something out Smile

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


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

PostPosted: Wed Feb 19, 2003 10:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 10:38 pm    Post subject: Reply with quote

OK, I'll have a look at those.
Thanks Very Happy

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 10:55 pm    Post subject: Reply with quote

Just downloaded and tried Vdsxfn.dll and it has just what I needed.
Thanks for the tip Very Happy

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Thu Feb 20, 2003 1:05 am    Post subject: Reply with quote

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. Smile

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 4:59 am    Post subject: Reply with quote

Worked great.
Thanks alot bweckel Very Happy

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Feb 20, 2003 5:22 am    Post subject: Reply with quote

bweckel wrote:
The following code will only work for VDS 4 and up.


Hey Bill, Smile

Actually, that code works in VDS3 as well... Wink

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Skit3000
Admin Team


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

PostPosted: Thu Feb 20, 2003 5:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 5:31 pm    Post subject: Reply with quote

Yeah, nice code. Your site was one of the first one I looked at when I started VDS about 4-5 days ago Smile
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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