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


Joined: 15 Aug 2002 Posts: 70 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 12:50 pm Post subject: filter characters |
|
|
Hello,
I was wondering if there is a way to filter characters out a text.
example: the text is "24/7", and I want to filter "/". How do I do this?
Tsunami1988 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 1:30 pm Post subject: |
|
|
Here it is...
__________________________________________________________________________________________________________________________
| Code: | %%string = "The text is "24/7", and I want to filter "/"."
%%searchfor = "/"
repeat
%%string = @strdel(%%string,@pos(%%searchfor,%%string),@pos(%%searchfor,%%string))
until @equal(@pos(%%searchfor,%%string),0)
info %%string |
I made a lot of string manipulate code that VDS doesn't have. You can take a look at it at my website. |
|
| Back to top |
|
 |
Tsunami1988 Contributor


Joined: 15 Aug 2002 Posts: 70 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 2:34 pm Post subject: |
|
|
| skit3000 wrote: | Here it is...
| Code: | %%string = "The text is "24/7", and I want to filter "/"."
%%searchfor = "/"
repeat
%%string = @strdel(%%string,@pos(%%searchfor,%%string),@pos(%%searchfor,%%string))
until @equal(@pos(%%searchfor,%%string),0)
info %%string |
I made a lot of string manipulate code that VDS doesn't have. You can take a look at it at my website. |
thnx, this works. |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 30, 2002 8:02 pm Post subject: |
|
|
Here's another way:
| Code: |
%%string = "24/7"
%%replace = "/"
repeat
%P = @pos(%%replace,%%string)
if @greater(%P,0)
%%string = @strdel(%%string,%P,)
end
until @zero(%P)
|
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 8:08 pm Post subject: |
|
|
Your way it almost the same, only you have used more lines... If you replace the %P variable with the value of it, you have the same code...
| Code: |
%%string = "24/7"
%%replace = "/"
repeat
rem Next line has now no use anymore.... If you remove it, it is exactly the same!
if @greater(@pos(%%replace,%%string),0)
%%string = @strdel(%%string,@pos(%%replace,%%string),)
end
until @zero(@pos(%%replace,%%string)) |
Last edited by Skit3000 on Sat Nov 30, 2002 8:13 pm; edited 1 time in total |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 30, 2002 8:12 pm Post subject: |
|
|
Different strokes for different folks!
My way uses one more lne of code, but the way my mind works mine is easier to read, for me that is. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 8:17 pm Post subject: |
|
|
| You're right there. I sometimes want to make code to complicated... |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 30, 2002 8:20 pm Post subject: |
|
|
One of the many ideas that I have about programming is to not only make it as useful as possible, but to make it so I can read the script to be able to see what it is doing. One bad habit of mine is that I do not use alot of comments in my source code, because of that, I had to adapt my programming to adjust for that. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 8:33 pm Post subject: |
|
|
Hey? Who added that long line to my post??? Or am I going mad?  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Nov 30, 2002 8:39 pm Post subject: |
|
|
LOL, I did.
On some browsers (mine for instance) code displays
with line breaks within the code tags. You can remedy
this by adding an unbroken underscore long enough
to make your longest line of code stay on one line.
Tommy had fixed that before the board upgrade,
I don't know if he'll do this one or not.
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: Sat Nov 30, 2002 8:44 pm Post subject: |
|
|
| I think it is easy to fix that. Just add a long line with the backgroundcolor as textcolor to the post, everytime the CODE tag will be used. That way you don't see it, but it will still be there... |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 8:48 pm Post subject: |
|
|
Oops... Doesn't work like it should be, because that long line will also disable the breakoff of normal text, like this long, long line....  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Nov 30, 2002 8:50 pm Post subject: |
|
|
I don't know how he did it, but it only made the post
as wide as needed. An arbitrary line length as you
suggested would prolly be too long or too short most
of the time.
Here's an old announcement for the line fix. We used
it until Tommy modified the board.
http://www.vdsworld.com/forum/viewtopic.php?t=59
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 |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Nov 30, 2002 8:53 pm Post subject: |
|
|
The text outside the code tags didn't break after
his fix either. Ya just hafta use the ENTER key...
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: Sat Nov 30, 2002 8:55 pm Post subject: |
|
|
I know... That's why I typed that long line...  |
|
| Back to top |
|
 |
|