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

Explain the concepts and capabilities of sql server?

539


Tell about MOM Tool(Microsoft Operator Manager)?

1405


Can we install sql server 2016 on windows 7?

664


Can truncate be rolled back?

531


How to modify an existing user defined function?

585






Mention the different authentication modes in sql server.

522


How to throw custom exception in Stored Procedure?

567


List the different index configurations possible for a table?

504


How to create dbo table in sql server?

504


How do you test your database? : sql server database administration

519


Can the “if update (colname)” statement be used in a delete trigger?

548


when would you go for denormalization? : Sql server database administration

477


What is difference between equi join and natural join?

530


What is sharding?

88


What is BLOCK statements in SQL?

795