且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获得一个字符串第一个字母。

更新时间:2021-08-14 15:50:41

Sergio del Amo< se *** @ sbox.tugraz.at>写道:
Sergio del Amo <se***@sbox.tugraz.at> writes:
有没有人知道是否有办法获取
字符串的第一个字母
Does anybody knows if there is a way to acces the first letter of a
string




string.charAt(0)



string.substring(0,1)



string。 substr(0,1)

/ L

-

Lasse Reichstein Nielsen - lr*@hotpop.com

DHTML死亡颜色:< URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>

''没有判断的信仰只会降低精神神圣。''



string.charAt(0)
or
string.substring(0,1)
or
string.substr(0,1)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
''Faith without judgement merely degrades the spirit divine.''


JRS:文章< fz ******** **@hotpop.com&gt ;,见于

news:comp.lang.javascript,Lasse Reichstein Nielsen< lr*@hotpop.com>

发布于周六, 2003年11月1日19:33:11: -
JRS: In article <fz**********@hotpop.com>, seen in
news:comp.lang.javascript, Lasse Reichstein Nielsen <lr*@hotpop.com>
posted at Sat, 1 Nov 2003 19:33:11 :-
Sergio del Amo< se *** @ sbox.tugraz.at>写道:
Sergio del Amo <se***@sbox.tugraz.at> writes:
有没有人知道是否有办法获取
字符串的第一个字母
Does anybody knows if there is a way to acces the first letter of a
string



string.charAt( 0)

string.substring(0,1)

string.substr(0,1)



string.charAt(0)
or
string.substring(0,1)
or
string.substr(0,1)




和引用的问题:那些访问第一个字符,

假设有一个。


S ='''123go''

OK = /([az])/i.test(S)

RESULT = RegExp。



And for the question as quoted : those access the first character,
assuming that there is one.

S = ''123go''
OK = /([a-z])/i.test(S)
RESULT = RegExp.


1


给了我''g''。外面的字母需要更大的搜索字词

AZ。


JS的结果是什么?!?
>
-

?约翰斯托克顿,英国萨里。 ?@merlyn.demon.co.uk Turnpike v4.00 IE 4?

< URL:http://jibbering.com/faq/> Jim Ley的新闻常见问题解答:comp.lang.javascript

< URL:http://www.merlyn.demon.co.uk/js-index.htm> JS数学,日期,来源。

< URL:http://www.merlyn.demon.co.uk/> TP / BP / Delphi / JS /& c。,FAQ主题,链接。
1

gives me ''g''. A larger search term will be needed for letters outside
A-Z.

What''s Result for in JS?!?

--
? John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ?
<URL:http://jibbering.com/faq/> Jim Ley''s FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.