String (computer science): Difference between revisions

Content deleted Content added
searching a substring in a longer string and sorting a list of strings
A common representation is an array of character codes, occupying one byte (e.g. in ASCII code) or two bytes (e.g. in unicode) each.
Line 3:
== Representation in programming languages ==
 
A common representation is an [[array]] of characters[[character code]]s, occupying one [[byte]] (e.g. in [[ASCII]] code) or two bytes (e.g. in [[unicode]]) each. The length can be stored implicitly by using a special terminating character (often [[NUL]], ASCII code 0) -- the [[C programming language]] uses this convention -- or explicitly, for example by prefixing the string with integer value (convention used in [[Pascal programming language|Pascal]]).
 
Here is an example of a NUL terminated string stored in a 10 [[Integral data types|byte]] buffer, along with its ASCII representation: