String Concatenation? (pt II)
Archiver
Posts: 46,084
For that matter, how do you assign a string to an array? Something
like this:
A var byte(7)
A="NITWIT"
doesn't work. Several other guesses involving \'s, $'s and ()'s
didn't work either...
Any thoughts?
Thanx.
like this:
A var byte(7)
A="NITWIT"
doesn't work. Several other guesses involving \'s, $'s and ()'s
didn't work either...
Any thoughts?
Thanx.
Comments
you'll need to load it one character at a time. You can, however, send
it out using the STR modifier in SEROUT.
name VAR Byte(7)
Setup:
name(0) = "N"
name(1) = "I"
name(2) = "T"
name(3) = "W"
name(4) = "I"
name(5) = "T"
Main:
SEROUT pin, baud, [noparse][[/noparse]STR name\6]
END
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: com120 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=IW6NpWi2yUprFKsVOT6K27OOH0xg3KMfrcWolM7IZaOhyWeG2I1H6MsDh1PUU5XB7YLSLTRMRokXlHGWs1uc]toad_koppel@y...[/url
Sent: Monday, May 31, 2004 3:45 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] String Concatenation? (pt II)
For that matter, how do you assign a string to an array? Something like
this:
A var byte(7)
A="NITWIT"
doesn't work. Several other guesses involving \'s, $'s and ()'s didn't
work either...
Any thoughts?
Thanx.
into the variable array:
nama1 DATA "NITWIT".0
name2 DATA "Homer",0
name VAR Byte(7)
idx VAR byte
idx=name2 ' which name
get_Name: ' can be subroutine
DO
READ idx, name(idx)
idx=idx+1
LOOP UNTIL name(idx)=0
SEROUT pin, baud, [noparse][[/noparse]STR name]
END
-- Tracy
>There are no string variables in PBASIC. You can create an array, but
>you'll need to load it one character at a time. You can, however, send
>it out using the STR modifier in SEROUT.
>
>name VAR Byte(7)
>
>Setup:
> name(0) = "N"
> name(1) = "I"
> name(2) = "T"
> name(3) = "W"
> name(4) = "I"
> name(5) = "T"
>
>Main:
> SEROUT pin, baud, [noparse][[/noparse]STR name\6]
> END
>
>-- Jon Williams
>-- Applications Engineer, Parallax
>-- Dallas Office
>
>
>
Original Message
>From: com120 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=kiE6s3ObAEgQLpd7lTAq-jra8-bO2v6ZZDDcAz2y7SIFTNLwPWmx7BQfqaPPC_TyLgDmH-so68-OVzwv]toad_koppel@y...[/url
>Sent: Monday, May 31, 2004 3:45 PM
>To: basicstamps@yahoogroups.com
>Subject: [noparse][[/noparse]basicstamps] String Concatenation? (pt II)
>
>
>For that matter, how do you assign a string to an array? Something like
>this:
>
>A var byte(7)
>A="NITWIT"
>
>doesn't work. Several other guesses involving \'s, $'s and ()'s didn't
>work either...
>
>Any thoughts?
>
>Thanx.