MAE 08 Lecture Notes - Lecture 19: Substring, C String Handling, Delimiter
Document Summary
A string consists of a set of characters that are contained between single quotation marks. A substring is a subset/ part of a string. Hello" is a substring of string hello world". Characters are letters of alphabet, digits, punctuation marks, white space, and control characters. Control characters are characters that cannot be printed, but accomplish a task, for example, backspace and tab. White space characters: new line and space (leading and trailing) Each character in a string is an element of a vector/matrices. Use [ ] operator, similar to combine two vectors. The function removes trailing blanks but not leading blanks. Use function char to combine strings vertically into a string matrix. The strings do not need to have the same length. Use function blanks(n) to create a n-character blank space. Use function deblank to remove trailing blank spaces. Use function strtrim to remove both leading and trailing blank spaces. Use function strcmp(string1, string2) to compare two strings.