finding indices in a string
조회 수: 8 (최근 30일)
이전 댓글 표시
how can i find the indices of the leading zeros in this string: '123 0009 90'
댓글 수: 0
답변 (2개)
Adam
2016년 12월 16일
idx = strfind( str, ' 0' );
will find you the start of each leading 0. Then you can count the zeros after each of those before a 'proper' number.
strsplit( str, ' ' );
will divide up your string into each component also, but getting the indices from that would be a tedious process so probably not too helpful.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!