__Function File:__**strcmp***(*`s1`,`s2`)-
Compares two strings, returning 1 if they are the same, and 0 otherwise.
**Note: For compatibility with MATLAB, Octave's strcmp function returns 1 if the strings are equal, and 0 otherwise. This is just the opposite of the corresponding C library function.**

__Function File:__**int2str***(*`n`)__Function File:__**num2str***(*`x`)-
Convert a number to a string. These functions are not very flexible,
but are provided for compatibility with MATLAB. For better control
over the results, use
`sprintf`

(see section Formatted Output).

__Built-in Function:__**setstr***(*`x`)-
Convert a matrix to a string. Each element of the matrix is converted
to the corresponding ASCII
character. For example,
setstr ([97, 98, 99])

creates the string

abc

__Built-in Variable:__**implicit_str_to_num_ok**-
If the value of
`implicit_str_to_num_ok`

is nonzero, implicit conversions of strings to their numeric ASCII equivalents are allowed. Otherwise, an error message is printed and control is returned to the top level. The default value is 0.

__Built-in Function:__**undo_string_escapes***(*`s`)-
Converts special characters in strings back to their escaped forms. For
example, the expression
bell = "\a";

assigns the value of the alert character (control-g, ASCII code 7) to the string variable

`bell`. If this string is printed, the system will ring the terminal bell (if it is possible). This is normally the desired outcome. However, sometimes it is useful to be able to print the original representation of the string, with the special characters replaced by their escape sequences. For example,octave:13> undo_string_escapes (bell) ans = \a

replaces the unprintable alert character with its printable representation. See section String Constants, for a description of string escapes.

__Function File:__**bin2dec***(*`s`)-
Given a binary number represented as a string of zeros and ones,
returns the corresponding decimal number. For example,
bin2dec ("1110") => 14

__Function File:__**blanks***(var{n})*-
Returns a string of
`n`blanks.

__Function File:__**deblank***(*`s`)-
Removes the trailing blanks from the string
`s`.

__Function File:__**dec2bin***(*`n`)-
Given a nonnegative integer, returns the corresponding binary number as
a string of ones and zeros. For example,
dec2bin (14) => "1110"

__Function File:__**dec2hex***(*`n`)-
Given a nonnegative integer, returns the corresponding hexadecimal
number as a string. For example,
dec2hex (2748) => "abc"

__Function File:__**findstr***(*`s`,`t`,`overlap`)-
Returns the vector of all positions in the longer of the two strings
`s`and`t`where an occurence of the shorter of the two starts. If the optional argument`overlap`is nonzero, the returned vector can include overlapping positions (this is the default). For example,findstr ("ababab", "a") => [1 3 5] findstr ("abababa", "aba", 0) => [1, 5]

__Function File:__**hex2dec***(*`s`)-
Given a hexadecimal number represented as a string, returns the
corresponding decimal number. For example,
hex2dec ("12B") => 299 hex2dec ("12b") => 299

__Function File:__**index***(*`s`,`t`)-
Returns the position of the first occurence of the string
`t`in the string`s`, or 0 if no occurence is found. For example,index ("Teststring", "t") => 4

**Note:**This function does not work for arrays of strings.

__Function File:__**rindex***(*`s`,`t`)-
Returns the position of the last occurence of the string
`t`in the string`s`, or 0 if no occurence is found. For example,rindex ("Teststring", "t") => 6

**Note:**This function does not work for arrays of strings.

__Function File:__**split***(*`s`,`t`)-
Divides the string
`s`into pieces separated by`t`, returning the result in a string array (padded with blanks to form a valid matrix). For example,split ("Test string", "t") => Tes s ring

__Function File:__**str2num***(*`s`)-
Convert the string
`s`to a number.

__Function File:__**str2mat***(*`s_1`, ...,`s_n`)-
Returns a matrix containing the strings
`s_1`, ...,`s_n`as its rows. Each string is padded with blanks in order to form a valid matrix.**Note:**This function is modelled after MATLAB. In Octave, you can create a matrix of strings by`[`.`s_1`; ...;`s_n`]

__Built-in Variable:__**string_fill_char**

__Function File:__**strrep***(*`s`,`x`,`y`)-
Replaces all occurences of the substring
`x`of the string`s`with the string`y`. For example,strrep ("This is a test string", "is", "&%$") => Th&%$ &%$ a test string

__Function File:__**substr***(*`s`,`beg`,`len`)-
Returns the substring of
`s`which starts at character number`beg`and is`len`characters long. For example,substr ("This is a test string", 6, 9) => is a test

**Note:**This function is patterned after AWK. You can get the same result by.`s`(`beg`: (`beg`+`len`- 1))

__Function File:__**tolower***(*`s`)-
Return a copy of the string
`s`, with each upper-case character replaced by the corresponding lower-case one; nonalphabetic characters are left unchanged. For example,tolower ("MiXeD cAsE 123") => "mixed case 123"

__Function File:__**toupper***(*`s`)-
Returns a copy of the string
`s`, with each lower-case character replaced by the corresponding upper-case one; nonalphabetic characters are left unchanged. For example,toupper ("MiXeD cAsE 123") => "MIXED CASE 123"

__Function File:__**toascii***(*`s`)-
Return ASCII representation of
`s`in a matrix. For example,toascii ("ASCII") => [ 65, 83, 67, 73, 73 ]

Octave also provides the following C-type character class test functions. They all operate on string arrays and return matrices of zeros and ones. Elements that are nonzero indicate that the condition was true for the corresponding character in the string array.

__Mapping Function:__**isalnum***(*`s`)- letter or a digit

__Mapping Function:__**isalpha***(*`s`)- letter

__Mapping Function:__**isascii***(*`s`)- ascii

__Mapping Function:__**iscntrl***(*`s`)- control character

__Mapping Function:__**isdigit***(*`s`)- digit

__Mapping Function:__**isgraph***(*`s`)- printable (but not space character)

__Mapping Function:__**islower***(*`s`)- lower case

__Mapping Function:__**isprint***(*`s`)- printable (including space character)

__Mapping Function:__**ispunct***(*`s`)- punctuation

__Mapping Function:__**isspace***(*`s`)- whitespace

__Mapping Function:__**isupper***(*`s`)- upper case

__Mapping Function:__**isxdigit***(*`s`)- hexadecimal digit

Go to the first, previous, next, last section, table of contents.