finding indices in a string
13 ビュー (過去 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!