check for new line in a string

조회 수: 59 (최근 30일)
Joshitha Giridhar
Joshitha Giridhar 2022년 1월 13일
댓글: Paul 2022년 1월 13일
How to check if a new line character exists in a string
  댓글 수: 2
KSSV
KSSV 2022년 1월 13일
What string you have? Show us string.
Joshitha Giridhar
Joshitha Giridhar 2022년 1월 13일
편집: Joshitha Giridhar 2022년 1월 13일
The problem is i know it does have a new line character but i still need to check through code

댓글을 달려면 로그인하십시오.

답변 (1개)

Paul
Paul 2022년 1월 13일
These functions might help
doc newline
doc contains
  댓글 수: 1
Paul
Paul 2022년 1월 13일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by