Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / checking strings

Author
Message
large_nostril
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United States
Posted: 14th Feb 2003 03:15
Ok, I just got around to making my savegame function and I decided to make it dummy proof. That is, the person who saves the game won't be able to use invalid characters in file (i.e. \,/,|,*,etc.). Well one invalid character is a the double quatation mark ("). How can I check the string for ". Also, is there an InString function or something to check the string. Right now I'm using this as my code.
If you want fresh underwear in the morning, take it off the night before.
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 03:23
To check for a quote mark use the following:

if mid$(filename$,ext)=chr$(34)

There is no InStr function sadly.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 04:29
wouldn't the str$("!") also work?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 04:37
If he wanted to search for an exclamation mark, yes

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 05:16
would make more sense to check for the any of the invalid characters all at once rather than doing the same function over and over and checking individually.

... you know i wonder if you can do something like
asc(""") lol, probably come up invalid wouldn't it
i'm trying to get my head around the string sets and i'm not even sure why right now because i'm working on binary compression right now.

i'd use something else to check the string within a savegame other than the " quota marks... but then again i'd save in value format (even the strings) - i mean if you have strings then anyone can simply open it up in notpad and give themselves like several thousand lives and whatnot

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
large_nostril
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United States
Posted: 14th Feb 2003 08:03
Thanks. Sorry for bugging all of you so much lately. I just haven't gotten down all of DB commands and syntax. The first languages I learned were C (no ++) and TI-Basic. In TI-Basic I can make my entire save function in 5 lines. Well, again, thanks both of you.

If you want fresh underwear in the morning, take it off the night before.
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 13:35
For an Instr function, you might be interested in my plug-in...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
large_nostril
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United States
Posted: 15th Feb 2003 03:59
Thanks MrTAToad. I'm truely sorry for what I said about your pi plugin. I just really thought it wasn't much use. Well, again, sorry.

If you want fresh underwear in the morning, take it off the night before.
large_nostril
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United States
Posted: 15th Feb 2003 04:04
Just got to your homepage MrTAToad. Unfortunately, I only have DB (no Pro). Thanks anyway.

If you want fresh underwear in the morning, take it off the night before.

Login to post a reply

Server time is: 2024-05-18 11:40:19
Your offset time is: 2024-05-18 11:40:19