Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get particular character position from string using C#

Tags:

c#

This is very basic question but I am not able to find the position of a particular character. For example:

string a = "ABCDE"; 

I want the position of "E" from above string.

like image 600
Imran Ali Khan Avatar asked Dec 01 '22 17:12

Imran Ali Khan


1 Answers

Use IndexOf

var pos = a.IndexOf('E');
like image 144
nphx Avatar answered Dec 04 '22 06:12

nphx