Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i want to find the how many character in a string, and find the the number of character occurred in that string using jquery. see the below string.


if i have the "Hello world" string then the result should be following.

H count is 1,
e count is 1,
ll count is 3,
o count is 2,
w count is 1,
r count is 1,
d count is 1.

What I have tried:

i don't, how can i do this. please help
Posted
Updated 15-May-18 22:42pm
Comments
jaket-cp 17-May-18 5:49am    
words of advice from solution 1 and 2 are good.
Here is a quick jsfiddle I knocked up so you can see how you could potentially do it in javascript
https://jsfiddle.net/oqe2um1f/
if you go through this one and see whats going on - there is a next installment of the fiddle to do a count of the letters
happy coding :)

 
Share this answer
 
Quote:
how can i do this. please help

Translation: Do my HomeWork. Urgent.
At least give it a try and tell us what problem you encounter.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900