Next: String Conversions, Previous: Creating Strings, Up: Strings
Removes the trailing blanks and nulls from the string s. If s is a matrix, deblank trims each row to the length of longest string.
Return the vector of all positions in the longer of the two strings s and t where an occurrence 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 ]
Return the position of the first occurrence of the string t in the string s, or 0 if no occurrence is found. For example,
index ("Teststring", "t") => 4Caution: This function does not work for arrays of strings.
Return the position of the last occurrence of the string t in the string s, or 0 if no occurrence is found. For example,
rindex ("Teststring", "t") => 6Caution: This function does not work for arrays of strings.
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"
Compares two character strings, returning true if they are the same, and false otherwise.
Caution: For compatibility with Matlab, Octave's strcmp function returns true if the character strings are equal, and false otherwise. This is just the opposite of the corresponding C library function.
Replaces all occurrences 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"
Return the substring of s which starts at character number beg and is len characters long.
If OFFSET is negative, extraction starts that far from the end of the string. If LEN is omitted, the substring extends to the end of S.
For example,
substr ("This is a test string", 6, 9) => "is a test"This function is patterned after AWK. You can get the same result by s(
beg: (
beg+
len- 1))
.