check for new line in a string

65 visualizaciones (últimos 30 días)
Joshitha Giridhar
Joshitha Giridhar el 13 de En. de 2022
Comentada: Paul el 13 de En. de 2022
How to check if a new line character exists in a string
  2 comentarios
KSSV
KSSV el 13 de En. de 2022
What string you have? Show us string.
Joshitha Giridhar
Joshitha Giridhar el 13 de En. de 2022
Editada: Joshitha Giridhar el 13 de En. de 2022
The problem is i know it does have a new line character but i still need to check through code

Iniciar sesión para comentar.

Respuestas (1)

Paul
Paul el 13 de En. de 2022
These functions might help
doc newline
doc contains
  1 comentario
Paul
Paul el 13 de En. de 2022
Example:
c1 = "The quick brown fox";
c2 = "jumped over the lazy dog";
c3 = c1 + newline + c2 % for example
c3 =
"The quick brown fox jumped over the lazy dog"
contains([c1;c2;c3],newline)
ans = 3×1 logical array
0 0 1
Check the doc page for newline to see if that's actually character you need to search for. Can also use contains() to search for more than one type of character if needed.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by