Farid Ala
Farid Ala

Reputation: 668

Working with chars and strings in C#

I'm writing a C# program that works with chars and strings.

String str= textbox1.text;
if(str[0]="'")
{
}

How I can use "'" in my if statement?

Regards.

Upvotes: 2

Views: 96

Answers (1)

Joe
Joe

Reputation: 82594

like this, escape ' with \

'\''

and ==

String str= textbox1.text;
if(str[0]=='\'')
{

}

Upvotes: 6

Related Questions