# strings

## Purpose

MATLAB string handling.

## Description

The statement `t = 'Hello,` `World`.`'` creates a vector whose components are the ASCII codes for the characters. The column dimension of `t` is the number of characters. It is no different than other MATLAB vectors, except that it displays as text instead of the decimal ASCII codes:

    t =
    Hello, World.

Associated with each MATLAB variable is a flag that, if set, tells the MATLAB output routines to display the variable as text. `t = abs(t)` is one way of clearing the flag so the vector is displayed in its decimal ASCII representation. `t = setstr(t)` sets the flag back to text display.

`isstr(t)` returns 1 if `t` is a string, and 0 otherwise.

Two single quotes indicate a quote within a string.

To concatenate strings, treat them as vectors:

    x = 'Hello, ';
    y = 'World';
    z = [x y]

    z =
    Hello, World.

## Examples

The string

    s = ['It is 1 o''clock', 7, 13, 'It is 2']

uses two quotes to indicate a single quote, and includes a bell (ASCII 7) on all platforms except Macintosh, and a carriage return (ASCII 13) on all platforms.

## See Also

    abs, isstr, setstr, strcmp

(c) Copyright 1994 by The MathWorks, Inc.