Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:37 03 Jan 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBasic: special characters in a string

Author Message
PilotPirx

Regular Member

Joined: 03/11/2020
Location: Germany
Posts: 71
Posted: 05:06pm 30 Dec 2024
Copy link to clipboard 
Print this post

Hello,
starting with MMBasic and graphics i got the problem to put special characters (f.e. >127) in a string.
How to define a string with characters which are not on the keyboard?
With the sinclair spectrum you could use caps shift and GRAPHICS to get these characters.
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1333
Posted: 05:12pm 30 Dec 2024
Copy link to clipboard 
Print this post

special character=chr$(ascii)

or

inc special_character$,chr$(ascii)

inc special_character$, STRING$( nbr, ascii )

ascii= 0 to 255
  Quote  With the sinclair spectrum you could use caps shift and GRAPHICS to get these characters.

There are no keys for these characters in PicoMite.

Michael
Edited 2024-12-31 03:23 by twofingers
causality ≠ correlation ≠ coincidence
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3831
Posted: 05:25pm 30 Dec 2024
Copy link to clipboard 
Print this post

Such as:

a = 128
b$ = chr$(a)

You can get at the value again:
c = asc(b$)

(then a and c are the same)

John
 
PilotPirx

Regular Member

Joined: 03/11/2020
Location: Germany
Posts: 71
Posted: 05:32pm 30 Dec 2024
Copy link to clipboard 
Print this post



  Quote  special character=chr$(nbr)

Which means such kind of string is not possible?
Only character=chr$(nbr)+chr$(nbr)+ and so on.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3831
Posted: 05:41pm 30 Dec 2024
Copy link to clipboard 
Print this post

  PilotPirx said  Only character=chr$(nbr)+chr$(nbr)+ and so on.

Yes.

Or use a loop.

John
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 923
Posted: 09:53pm 30 Dec 2024
Copy link to clipboard 
Print this post

Also see Special Characters in Strings on page 23 of the manual. Using OPTION ESCAPE allows their entry in decimal escaped by a backslash.
Latest F4 Latest H7
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2200
Posted: 09:59pm 30 Dec 2024
Copy link to clipboard 
Print this post

  twufingers said  inc special_character$,chr$(ascii
and
  Quote  Or use a loop.

so:-
> for n=128 to 138 : inc s$, chr$(n) : next
> for n=1 to 11 : ? asc(mid$(s$,n,1)); : next
128 129 130 131 132 133 134 135 136 137 138
>
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2025