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 / Getting a specific character from a string.

Author
Message
BoB Vila
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 4th Apr 2003 06:23
Whats the easiest way to get a specific character from a string?
I'm used to strings being an array of characters and being able to get a specific character out of that string. But there doesn't seem to be a command to specify capturing from a start and endpoint of a string.

What should I do?
Bobvila.com made me take off my avatar! (dunno how they found out)
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 4th Apr 2003 06:25
use the mid$() command

like this


for i = 1 to len(string$)
if mid$(string$,i) = mychar$ then match = 1
next i
BoB Vila
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 4th Apr 2003 06:28
Doesn't mid$ give you the entire string of characters starting from value?

Bobvila.com made me take off my avatar! (dunno how they found out)
BoB Vila
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 4th Apr 2003 06:42
From what it looks like, the mid$ function should work something like

Mid$(String,StartValue,NumberofCharacters) if the number of characters value is 0 then it should read to the end.

Bobvila.com made me take off my avatar! (dunno how they found out)
BoB Vila
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 4th Apr 2003 06:53
Ahhh! yes, RealGameTools included a dll with extra string commands. Woo hoo..

Thankyou Guy!!!

Bobvila.com made me take off my avatar! (dunno how they found out)

Login to post a reply

Server time is: 2024-11-24 08:36:11
Your offset time is: 2024-11-24 08:36:11