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
What is the index requirement in SQL Azure?
Mention the differences between local and global temporary tables.
What is the use of commit?
How to create a dynamic cursor with the dynamic option?
Explain “row_number()” in sql server with an example?
Which tcp/ip port does sql server run on? How can it be changed?
what is difference between NULL and ISNULL in SQL Server 2008?
What are character string data types in ms sql server?
is there a column to which a default can't be bound? : Sql server database administration
How to change parameter value inside the report?
This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?
What is sql server 2000 work load governor?
Explain how to integrate the ssrs reports in application?
How to stop log file growing too big?
How to generate create view script on an existing view?