如何在javascript中拆分strng? [英] how to split the strng in javascript?
本文介绍了如何在javascript中拆分strng?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果分隔符之间没有空格,如何在javascript中拆分strng?
例如:
我必须按字符串将字符串分开:|:
我有像::::
这样的字符串
当我尝试拆分字符串时,结果为::::
而不是array [4].
how to split the strng in javascript if there is no spaces between sepration?
for example:
i have to split the string by string :|:
and i have string like ::::
when i am trying to split the string then resulted as ::::
instead of array[4].
how can i do this in c# as well as javascript?
推荐答案
对于JavaScript: ^ ].
对于.NET: http://msdn.microsoft.com/en-us/library/system.string.split.aspx [ ^ ].
在这两种情况下,都指定了分隔符,因此不需要空格字符.目前尚不清楚您的问题是什么-一切正常.
—SA
For JavaScript: http://www.w3schools.com/jsref/jsref_split.asp[^].
For .NET: http://msdn.microsoft.com/en-us/library/system.string.split.aspx[^].
In both cases, the separator is specified so there is no need in space characters. It''s not clear what is your problem — all works properly.
—SA
这篇关于如何在javascript中拆分strng?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文