Programming and Data Types    

Creating Two-Dimensional Character Arrays

When creating a two-dimensional character array, be sure that each row has the same length. For example, this line is legal because both input rows have exactly 13 characters.

When creating character arrays from strings of different lengths, you can pad the shorter strings with blanks to force rows of equal length.

A simpler way to create string arrays is to use the char function. char automatically pads all strings to the length of the longest input string. In this example, char pads the 13-character input string 'Thomas R. Lee' with three trailing blanks so that it will be as long as the second string.

When extracting strings from an array, use the deblank function to remove any trailing blanks.


  Character Arrays Converting Characters to Numeric Values