Xlaydos,
I feel I should stress to you to look into DarkBasic's commands listing, within the help files. The question you asked about string manipulation tells me you haven't taken the time to do so. The listings are layed out by category, and one of them is on 'text'. This category shows and talks about all the commands available to print text to the screen, manipulate strings, and the use of ASCII codes.
A few commands to extract characters from a string are:
1.)
LEFT$()
2.)
RIGHT$()
3.)
MID$()
The first command will extract an amount of characters from left to right. For example, if you have a string with the text,
Hello World!, then
newchar$ = LEFT$("Hello World!",3) would fill
newchar$ with the 'word'
Hel. It extracted the first three characters from the left.
The second command is the same, except that the characters are extracted from the right.
newchar$ = RIGHT$("Hello World!",3) would fill
newchar$ with the 'word'
ld!.
The last command here can be used to extract a single character at a time. It will extract, from left to right, a single character, given a value. For example,
newchar$ = MID$("Hello World!",3) will fill
newchar$ with the character
l. It has extracted the third character from the string.
There are also many other commands that can be used to manipulate strings in amazing ways. One last, for example, is
ASC(), which will return the ASCII number of the first character in a string. By the way, here is a small program you can use, which prints to the screen ASCII numbers, followed by their corresponding keyboard characters.
set display mode 800,600,32
sync on
sync rate 80
do
for t = 1 to 32
set cursor 0,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 33 to 47
set cursor 40,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 48 to 57
set cursor 80,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 58 to 64
set cursor 120,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 65 to 90
set cursor 160,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 91 to 96
set cursor 200,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 97 to 122
set cursor 240,u
print t,";",chr$(t)
inc u,16
next t
u = 0
for t = 123 to 125
set cursor 280,u
print t,";",chr$(t)
inc u,16
next t
u = 0
sync
cls
loop
+NanoBrain+