MATLAB string processing

Source: Internet
Author: User
Tags strtok

MATLAB string processing

% string processing
a= ' a '; b= ' b b '; c= ' CCCC '; m= '
%Get string length
Length (a)
% connects two strings, and the rightmost space of each string is trimmed
D=strcat (A,C)
Length (d)
% joins multiple lines of string, each line length can be unequal, automatically the non-longest string the rightmost fill the space
% makes equal to longest string, ignores empty string
E=strvcat (A,B,M)
Size (E)
%char connection, empty string will be filled with spaces
F=char (A,B,M)
Size (f)
%STRCMP compares whether two strings are exactly equal, yes, returns TRUE, otherwise, returns false
%STRNCMP compares two strings before n characters are equal, yes, returns TRUE, otherwise, returns false
%strcmpi compares two strings for exact equality, ignoring the case of letters
%strncmpi compares two strings before n characters are equal, ignoring the case of letters
%isletter to detect if each character in a string is an English letter
%isspace detects whether each character in a string is a format character (space, carriage return, tab, line break, etc.)
%isstrprop detects whether each character of a character falls within a specified range
A= ' d sdsdsd 15# ';
B=isletter (a)
C=isspace (a)
% string substitution and lookup
%strrep string substitution for case-sensitive
% Strrep (STR1,STR2,STR3)
% it replaces all str2 strings in the str1 with STR3.
%strfind (Str,patten) to find if there is a pattern in Str, return to the occurrence position, no return empty array
%findstr (STR1,STR2) finds the position in str1 and str2 where shorter strings appear in longer strings and does not appear to return an empty array
%strmatch (PATTEN,STR) checks if Patten is consistent with the leftmost part of STR
%strtok (Str,char) returns the part and the following part of the string specified by Char in Str.
mm= ' Youqwelcome ';
[Mm1,mm2]=strtok (mm, ' Q ')
% blanks (n) creates a string consisting of n spaces
% Deblank (str) Trimming trailing spaces of a string
% Strtrim (str) cut the beginning and trailing spaces of a string, tab, carriage return
% Lower (str) converts letters in a string to lowercase
% Upper (str) converts letters in a string to uppercase
%sort (str) sorts a string by the ASCII value of the character
%num2str converting a number to a numeric string
%str2num converting a numeric string to a number
%mat2str converting an array into a string
%int2str a character array that converts a numeric array to an integer number

MATLAB string processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.