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.

Newcomers DBPro Corner / How can i see if INPUT contains a letter?

Author
Message
GR3G0R
21
Years of Service
User Offline
Joined: 7th Nov 2003
Location: Dubai, UAE
Posted: 4th Feb 2004 19:19
Okay, I am trying to make a speech program thing. You know, Text2Speech thing.

Anyway, i was wondering if there was a code for like:

INPUT"Words: ",hhh$
if hhh$ CONTAINTS "a" then play sound 1

or something. Is there a code for CONTAINS?

Thanks in advanced

-------------------------
I'm new to DBPro. Don't hate me.
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 4th Feb 2004 19:25 Edited at: 4th Feb 2004 19:25
look at the help files for text, and scroll down. I think DB has the command "mid$" and "len"


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 4th Feb 2004 19:56
for i= 1 to len(hhh$)
if mid$(hhh$,i)="a" then play sound 1
next i

that should work, though untested


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
GR3G0R
21
Years of Service
User Offline
Joined: 7th Nov 2003
Location: Dubai, UAE
Posted: 4th Feb 2004 19:59 Edited at: 4th Feb 2004 19:59
ok thanks, but red_eye, what is i?

-------------------------
I'm new to DBPro. Don't hate me.
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 4th Feb 2004 20:54
The code he used is a FOR....NEXT loop.

'i' is the letter that he used. It could be anything (most people used x or t)



That code will repeat 5 times, each time t will be different (first it will be 1, then 2, then 3.....). Whenever you put t in the loop it will be replaced with a number.

It's quite hard to explain but play with it and you'll get the idea.

Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 4th Feb 2004 20:57
<Advert> My tut deals with all that . </Advert>

Do you bite your thumb at me sir?
The Basics of DBPro Tutorial, on my site now!
Athelon XP 1600 Plus (1.4ghz) - ATI Radeon 9600 Pro - 256mb RAM
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 5th Feb 2004 01:39
To search a string for any given amount of characters, just use the instr$() command.

http://darkbasicpro.thegamecreators.com/?m=forum_view&t=23931&b=6

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-11-26 04:21:29
Your offset time is: 2024-11-26 04:21:29