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 / adding and substracting strings

Author
Message
someone namedlink
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: Dream Planet
Posted: 14th Aug 2004 11:05
cand you add two strings to one? and can you delete parts of the string? I haven't found anything yet about that.

DIV/DBP-coder
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 14th Aug 2004 11:17
You can add two or more strings togethere easily.

a$ = "a"
b$ = " "
c$ = "string"
d$ = a$ + b$ + c$
print d$

ouputs
a string

Deleting parts of a string is more difficult, look up these commands in the help.
LEN, LEFT$, RIGHT$ or MID$

a$ = "a string"
b$ = left$(a$,3)
print b$

outputs
a s

a$ = "a string"
b$ = right$(a$,3)
print b$

outputs
ing

a$ = "a string"
b$ = mid$(a$,3)
b$ = b$ + mid$(a$,5)

outputs
sr
print b$

PII 300 : 64mb ram : voodoo II 12mb : Win98
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 14th Aug 2004 22:06
if at some point you want some additional string functions, we have these



included in our free plugin for DBP. Click the logo below for details


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 15th Aug 2004 01:41
What about the LEN command as well? Very handy for manipulating stringes. It fetches the number of characters (including BLANK spaces) in a string. You MUST get the number before you begin to manipulate the characters in a string, because if you try to grab the seventh character in a five character string, you will get an error!

"I attribute the quarrelsome nature of the Middle Ages young men entirely to the want of the soothing weed."
-Jerome K. Jerome(1859-1927),Writer
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 15th Aug 2004 02:01
well, LEN() is in dbp, and using our MID() you dont have that problem with errors


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo

Login to post a reply

Server time is: 2024-11-27 06:33:54
Your offset time is: 2024-11-27 06:33:54