Why does the STRCAT command remove the trailing spaces while performing a concatenation in MATLAB 7.4 (R2007a)?
Afficher commentaires plus anciens
When I was performing some string concatenations, I noticed that STRCAT removes some characters that are not empty spaces, including new line characters from my strings.
I added a new line after a hello in string a. I did this using the SPRINTF command.
a = sprintf('hello \n')
b = 'world'
c = strcat (a , b)
For the above piece of code I received the following result
c = helloworld
I added defind two strings as shown below and I have added 5 spaces after hello in string a.
a = 'hello '
b = ' world'
c = strcat (a , b)
I received the following result
c = helloworld
Why the newline is also recognized as a trailing whitespace character?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!