如何在jquery中查找字符串中有多少字符及其计数 [英] How to find how many character and their count in a string in jquery

查看:122
本文介绍了如何在jquery中查找字符串中有多少字符及其计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查找字符串中的字符数,并使用jquery查找该字符串中出现的字符数。看下面的字符串。





如果我有Hello world字符串,那么结果应该跟随。



H计数为1,
$ b $计数为1,

计数为3,

o count是2,

w计数是1,

r计数是1,

d计数是1.



我尝试了什么:



i不,我该怎么办呢。请帮助

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

推荐答案

jQuery教程 [ ^ ]


引用:

我该怎么办呢。请帮助



翻译:做我的HomeWork。紧急。

至少尝试一下,告诉我们你遇到了什么问题。



我们不做你的家庭作业。

HomeWork不会在乞求其他人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解以及你所遇到的问题应用它们。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


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.


这篇关于如何在jquery中查找字符串中有多少字符及其计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆