获取字符串的所有第一个字符 [英] Getting all first character of string
问题描述
我有2个文本框,其中第一个文本框我输入任何类似helleo你好吗
onchange evnent of first textbox我需要拳头所有字符串的第二个字符串文本框。
例子。
textbox1 = Unicode光学包机识别
texbox2 = UoCr (输出)我在firsttextbox.all的第一个字符串更改事件时需要。
我尝试了什么:
jQuery('#textbox1')。on('input' ,function(){
});
i have 2 textbox where first textbox i type anything like "helleo how are you"
onchange evnent of first textbox i required fist all char of string in second textbox.
example.
textbox1 = Unicode optical charter recognition
texbox2 = UoCr (output) i required on change event of firsttextbox.all first char of string.
What I have tried:
jQuery('#textbox1').on('input', function() {
});
推荐答案
这里应该有助于你开始使用 CP_GetAllFirstLetter - JSFiddle [ ^ ]
Here something that should help you get going CP_GetAllFirstLetter - JSFiddle[^]
var str = " Unicode optical Charter recognition";
var flRegex = str.match(/\b(\w)/g);
输出:UoCr
参考: javascript - 返回字符串中每个单词的第一个字符 - Stack Overflow [ ^ ]
Output: UoCr
Reference: javascript - Return First Character of each word in a string - Stack Overflow[^]
这篇关于获取字符串的所有第一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!