{"title":"Byte data type","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/byte/byte-data-type/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/byte/byte-data-type, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/byte/byte-data-type","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Stores a single, 8-bit character as a value in the range 0 to 255.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Instance methods","slug":"instance-methods","at":275,"chars":309},{"level":2,"title":"Example","slug":"example","at":584,"chars":943},{"level":2,"title":"Related information","slug":"related-information","at":1527,"chars":117}],"text":"> Version: _Available or changed with runtime version 1.0._\nStores a single, 8-bit character as a value in the range 0 to 255. You can easily convert this data type from a number to a character and vice versa. This means you can use mathematical operators on Byte variables.\n## Instance methods\nThe following methods are available on instances of the Byte data type.\nMethod name|Description\nbyte-totext--method|Converts the value to a text. Equivalent to calling Format(value, 0, 0).\nbyte-totext-boolean-method|Converts the value to a text. Equivalent to calling Format(value, 0, 0).\n## Example\nThe following example assumes that you have a Byte variable named B and a Text variable named S.\nYou can assign a constant string of the length 1 to a Byte variable, as shown in the first line of the following code example. You can assign a single character in a Text or Code variable to a Byte variable, as shown in the second line of the following code example. You can assign a numeric value to a Byte variable, as shown in the third line of the following code example. This causes the Byte variable to contain the character from the ASCII character set that corresponds to the numeric ASCII code.\n```al\nB := 'A';\nB := S[2];\nB := 65;\n```\nYou cannot assign a character to a position greater than the position of the null terminator. For example, if the value of the text variable MyText is 'abc', then the null terminator is at position 4 and the following assignment causes a run-time error to occur.\n```al\nMyText[5] := 'e';\n```\n## Related information\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}