| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: [Developers] Replacing Text |
Sharing this message with those who may be interested:
-------- Forwarded Message ---------
Original: DATE..... 11 Jan 2019, 04:19p
Original: FROM..... Developers{at}winserver.com
Original: TO....... ROBERT WOLFE
Original: SUBJECT.. RE: [Developers] Replacing Text
Original: FORUM.... Private Email
On Jan 11, 2019 05:01am, Developers{at}winserver.com wrote to ROBERT WOLFE:
> Hi
> This maybe a simple question but not sure of the best way to do it.
> I have a variable - for example say it contains "Mr John Smith"
> I need to change this variable to = "Mr%20John%20Smith"
> So basicially finding a space and replacing it with %20
> Can anyone suggest the best way to do this ?
Dave, I believe something like this might help you out for a starting point:
//
// Will search for a spaces in a string and replace it with %20/
// Coded by Robert Wolfe
//
#include "util.wch"
#include "cmdline.wch"
if (GetNode() = 0) then
LoginSystem()
end if
dim string1 as string = "Mr. John Doe, Sr."
dim string2 as string = ""
dim char as string = ""
dim index as integer = 0
for index = 1 to len(string1)
char = mid(string1, index, 1)
if char = " " then char = "%20"
string2 = string2 + char
next index
print "string1 = "; string1
print "string2 = "; string2
When run using 'wcrun.exe -r' the code yields the following:
string1 = Mr. John Doe, Sr.
string2 = Mr.%20John%20Doe,%20Sr.
As a sidenote, I always include the LoginSystem() routine in all of my
programs so that I am not forced to log into the BBS when I want to run the
WCX outside of the BBS. Hope this helps.
... Platinum Xpress & Wildcat!..... Nice!!!!
-!-------------------------------------------------------------------
To unsubscribe, send e-mail to wclistserve{at}winserver.com with
UNSUBSCRIBE Developers in the message body on a line by itself.
To contact the list admin, e-mail ListAdmin{at}winserver.com
-!-------------------------------------------------------------------
----- End of Forwarded Message -----
... Platinum Xpress & Wildcat!..... Nice!!!!
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: Omicron Theta (1:116/17)SEEN-BY: 15/0 19/36 34/999 90/1 104/57 116/18 120/331 123/140 153/7715 218/700 SEEN-BY: 220/60 222/2 229/426 230/150 152 250/1 261/38 100 266/512 267/155 SEEN-BY: 275/100 282/1031 1056 291/1 111 320/119 219 340/400 342/13 396/45 SEEN-BY: 633/0 267 280 281 412 509 712/132 620 848 770/1 801/161 189 3634/12 SEEN-BY: 5020/1042 @PATH: 116/17 18 261/38 712/848 633/280 267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.