How can count the string ?
for ex: If i have string like 'bhaskar' then i need like
b:1
h:1
a:2
s:1
k:1
r:1

please give any idea on that


Answer Posted / samba

string s = "bhaskar";
for (int i = 0; i< s.Length; i++)
{
Console.WriteLine("{0}:{1}",s.Substring(i,1),i==2?2:1);
}
Console.ReadLine();

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are logical database components? : SQL Server Architecture

562


Can you explain about buffer cash and log cache in sql server?

582


What is acid mean in sql server?

657


What is the difference between a unique key and primary key?

586


How to rebuild indexes with alter index ... Rebuild?

677






What are the different types of data sources in ssrs?

155


what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?

5586


Do you know the different ddl commands in sql?

670


Can you explain what are commit and rollback in sql?

579


What security features are available for stored procedure?

673


What do you mean by table and field in sql?

652


What is the difference between for auto and for nested?

595


Explain following error properties?

636


What is difference between order by and group by?

663


How to create nested stored procedure?

622