1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 11:40:38 +00:00
QB64-PE/internal/help/ASC_(statement).txt
SteveMcNeill 33adc04fc4 Add temp folder to repo. It's necessary as well!
Just more initial setting on... nothing much to see here.
2022-04-28 13:39:56 -04:00

47 lines
1.5 KiB
Plaintext

The [[ASC (statement)|ASC]] statement allows a '''QB64''' program to change a character at any position of a [[STRING]] variable.
{{PageSyntax}}
: [[ASC (statement)|ASC]]({{Parameter|stringExpression$}}[, {{Parameter|position%}}]) = {{Parameter|code%}}
{{PageDescription}}
* The {{Parameter|stringExpression$}} variable's value must have been previously defined and cannot be an empty string ("").
* {{Parameter|position%}} is optional. If no position is used, the leftmost character at position 1 is assumed.
* {{Parameter|position%}} cannot be zero or greater than the string's [[LEN|length]] or an [[ERROR Codes|Illegal function error]] will occur.
* The [[ASCII]] replacement {{Parameter|code%}} value can be any [[INTEGER]] value from 0 to 255.
* Some [[ASCII]] control characters will not [[PRINT]] a character or may format the [[SCREEN]]. [[_PRINTSTRING]] can print them graphically.
{{PageExamples}}
''Example:'' Demonstrates how to change existing text characters one letter at a time.
{{CodeStart}}
a$ = "YZC"
{{Cl|ASC (statement)|ASC}}(a$) = 65 ' CHR$(65) = "A"
{{Cl|ASC (statement)|ASC}}(a$, 2) = 66 ' CHR$(66) = "B"
{{Cl|PRINT}} a$ 'ABC
{{Cl|ASC (statement)|ASC}}(a$, 2) = 0 ' CHR$(0) = " "
{{Cl|PRINT}} a$
{{Cl|ASC (statement)|ASC}}(a$, 2) = {{Cl|ASC}}("S") ' get code value from ASC function
{{Cl|PRINT}} a$
{{CodeEnd}}
{{OutputStart}}
ABC
A C
ASC
{{OutputEnd}}
{{PageSeeAlso}}
* [[ASC]] {{text|(function)}}
* [[MID$ (statement)]]
* [[_PRINTSTRING]]
* [[INKEY$]], [[ASCII]]
{{PageNavigation}}
<