how to compare special characters in string

I have a strings
string='$(0)parameter'
I want to find if '$' is present in the string or not. Can any one tell me how to do that? Using which string functions I can achieve that?

2 件のコメント

Image Analyst
Image Analyst 2014 年 7 月 10 日
Why is $ special ? It's a normal printable character like 3 or "A" or anything like that so you can use strfind().
Ajay Pherwani
Ajay Pherwani 2014 年 7 月 11 日
hey thanks , strfind worked

サインインしてコメントする。

 採用された回答

Sara
Sara 2014 年 7 月 10 日

0 投票

If index is empty, $ is not in the string
str='$(0)parameter';
index = strfind(str,'$');

1 件のコメント

ananth a
ananth a 2019 年 11 月 27 日
if I want to search with '$(0)'. how can i do that?
Because i have to search with {"some name": value, this part.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2014 年 7 月 10 日

コメント済み:

2019 年 11 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by