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 Kommentare

Image Analyst
Image Analyst am 10 Jul. 2014
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 am 11 Jul. 2014
hey thanks , strfind worked

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Sara
Sara am 10 Jul. 2014

0 Stimmen

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

1 Kommentar

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 10 Jul. 2014

Kommentiert:

am 27 Nov. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by