{"title":"Char data type","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/char/char-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/char/char-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/char/char-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, 16-bit character as a value in the range 0 to 65535.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Example","slug":"example","at":271,"chars":813},{"level":2,"title":"Related information","slug":"related-information","at":1084,"chars":117}],"text":"> Version: _Available or changed with runtime version 1.0._\nStores a single, 16-bit character as a value in the range 0 to 65535. You can convert this data type from a number to a character and vice versa. This means you can use mathematical operators on Char variables.\n## Example\nThe following example assumes that you have a Char variable named C and a Text or Code variable named S.\nYou can assign a constant string of the length 1 to a Char variable, as shown in the first line of the following code example. You can assign a single Char in a Text or Code variable to a Char variable, as shown in the second line of the following code example. You can assign a numeric value to a Char variable, as shown in the third line of the following code example.\n```al\nC := 'A';\nC := S[2];\nC := 65;\n```\nYou cannot assign a Char 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>"}