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 do i remove the rightmost character from a string?

Author
Message
Monzi
20
Years of Service
User Offline
Joined: 10th May 2004
Location: Denmark
Posted: 8th Jun 2004 16:54 Edited at: 8th Jun 2004 16:54
i'm trying to remove the rightmost character from a string
i tried this:
nameenter$=nameenter$-right$(nameenter$,1)

but it doesnt work
any suggestions anyone?
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Jun 2004 17:02 Edited at: 8th Jun 2004 17:32
left and len(yourstring)-1 comes to mind.
hint hint


edit: try this

s as string="hello world"
ns as string
ns=left$(s,len(s)-1)
print ns
wait key


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Monzi
20
Years of Service
User Offline
Joined: 10th May 2004
Location: Denmark
Posted: 8th Jun 2004 20:52
Hey CattleRustler
Here is what i have.. but i cant get it to work:

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Jun 2004 21:04 Edited at: 8th Jun 2004 21:06
here ya go

Do
cls
if inkey$()<>""
nameenter$=nameenter$+inkey$()
wait 100
endif
if keystate(14)=1
nameenter$=left$(nameenter$,len(nameenter$)-1)
wait 100
endif
Center Text 400,425,nameenter$
Loop

BackSpace was scancode 14 not 15 and I changed to keystate() command and also you had a comment on a line without a : in between. DBP cant comment at end of lines without a :


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Monzi
20
Years of Service
User Offline
Joined: 10th May 2004
Location: Denmark
Posted: 8th Jun 2004 21:05 Edited at: 8th Jun 2004 21:07
hmm .. so all that was wrong was the scancode?
my scancode table is wrong then ..
off to google to find a correct one
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Jun 2004 21:06
read my edit


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Jun 2004 21:16



* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Monzi
20
Years of Service
User Offline
Joined: 10th May 2004
Location: Denmark
Posted: 9th Jun 2004 00:24
Oh thanks CattleRustler
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jun 2004 00:30
any time


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo

Login to post a reply

Server time is: 2024-11-26 20:17:14
Your offset time is: 2024-11-26 20:17:14