AJax¼¼Êõ

js split µÄÓ÷¨ºÍ¶¨Òå js split·Ö¸î×Ö·û´®³ÉÊý×éµÄʵÀý´úÂë

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2018-07-20 08:03 ÎÒÒªÆÀÂÛ( )

¹ØÓÚjs splitµÄÓ÷¨£¬ÎÒÃǾ­³£ÓÃÀ´½«×Ö·û´®·Ö¸îΪÊý×é·½±ãºóÐø²Ù×÷£¬½ñÌìдһ¶Î¹ã¸æÅжϴúÂëµÄʱºò£¬¾¹È»ÍüÁËsplitµÄÓ÷¨ÁË£¬ÌØÕûÀíÏ£¬·½±ãÐèÒªµÄÅóÓÑ

¹Øע΢ÐŹ«ÖÚºÅ

ɨһɨ

js split µÄÓ÷¨ºÍ¶¨Òå js split·Ö¸î×Ö·û´®³ÉÊý×éµÄʵÀý´úÂë

תÔØ  ¸üÐÂʱ¼ä£º2012Äê05ÔÂ13ÈÕ 00:26:33   ×÷Õߣº  

¹ØÓÚjs splitµÄÓ÷¨£¬ÎÒÃǾ­³£ÓÃÀ´½«×Ö·û´®·Ö¸îΪÊý×é·½±ãºóÐø²Ù×÷£¬½ñÌìдһ¶Î¹ã¸æÅжϴúÂëµÄʱºò£¬¾¹È»ÍüÁËsplitµÄÓ÷¨ÁË£¬ÌØÕûÀíÏ£¬·½±ãÐèÒªµÄÅóÓÑ

¹ØÓÚjs splitµÄÓ÷¨ÆäËüÒ²²»¶à˵ʲô£¬ÏÂÃæÖ±½Ó¾ÙÀý¸ø´ó¼Ò¿´¿´

¸´ÖÆ´úÂë ´úÂëÈçÏÂ:


<script language="javascript">
str="2,2,3,5,6,6"; //ÕâÊÇÒ»×Ö·û´®
var strs= new Array(); //¶¨ÒåÒ»Êý×é
strs=str.split(","); //×Ö·û·Ö¸î
for (i=0;i<strs.length ;i++ )
{
document.write(strs[i]+"<br/>"); //·Ö¸îºóµÄ×Ö·ûÊä³ö
}
</script>


Êä³ö½á¹û¾ÍÊÇ
2
2
3
5
6
6

js split¾ÍÊǽ«Ò»×Ö·û´®ÒÔÌض¨µÄ×Ö·û·Ö¸î³É¶à¸ö×Ö·û´®,´ó¼ÒÓ¦µ±Ò»¿´¾Í¶®ÁË°É¡£

ÏÂÃæÊÇÓйØjs splitµÄ¶¨ÒåºÍÓ÷¨£¬¹Ù·½²Î¿¼¡£

¶¨ÒåºÍÓ÷¨
split() ·½·¨ÓÃÓÚ°ÑÒ»¸ö×Ö·û´®·Ö¸î³É×Ö·û´®Êý×é¡£

Óï·¨
stringObject.split(separator,howmany)

²ÎÊý ÃèÊö
separator ±ØÐè¡£×Ö·û´®»òÕýÔò±í´ïʽ£¬´Ó¸Ã²ÎÊýÖ¸¶¨µÄµØ·½·Ö¸î stringObject¡£
howmany ¿ÉÑ¡¡£¸Ã²ÎÊý¿ÉÖ¸¶¨·µ»ØµÄÊý×éµÄ×î´ó³¤¶È¡£Èç¹ûÉèÖÃÁ˸òÎÊý£¬·µ»ØµÄ×Ó´®²»»á¶àÓÚÕâ¸ö²ÎÊýÖ¸¶¨µÄÊý×é¡£Èç¹ûûÓÐÉèÖøòÎÊý£¬Õû¸ö×Ö·û´®¶¼»á±»·Ö¸î£¬²»¿¼ÂÇËüµÄ³¤¶È¡£


·µ»ØÖµ
Ò»¸ö×Ö·û´®Êý×é¡£¸ÃÊý×éÊÇͨ¹ýÔÚ separator Ö¸¶¨µÄ±ß½ç´¦½«×Ö·û´® stringObject ·Ö¸î³É×Ó´®´´½¨µÄ¡£·µ»ØµÄÊý×éÖеÄ×Ö´®²»°üÀ¨ separator ×ÔÉí¡£

µ«ÊÇ£¬Èç¹û separator ÊÇ°üº¬×Ó±í´ïʽµÄÕýÔò±í´ïʽ£¬ÄÇô·µ»ØµÄÊý×éÖаüÀ¨ÓëÕâЩ×Ó±í´ïʽƥÅäµÄ×Ö´®£¨µ«²»°üÀ¨ÓëÕû¸öÕýÔò±í´ïʽƥÅäµÄÎı¾£©¡£

Äú¿ÉÄܸÐÐËȤµÄÎÄÕÂ:

  • split
  • Êý×é
  • Ïà¹ØÎÄÕÂ

    ×îÐÂÆÀÂÛ

    ´ó¼Ò¸ÐÐËȤµÄÄÚÈÝ

    ×î½ü¸üеÄÄÚÈÝ

    ³£ÓÃÔÚÏßС¹¤¾ß

    ¡¡

    1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

    Ïà¹ØÎÄÕÂ
    • @RequestBody List ajaxÇëÇójsonÊý×é ºǫ́spring mvc ÎÞ·¨½ÓÊÕ

      @RequestBody List ajaxÇëÇójsonÊý×é ºǫ́spring mvc ÎÞ·¨½ÓÊÕ

      2017-12-10 09:00

    • JavaScriptÖÐÊý×é³£¼û²Ù×÷¼¼ÇÉ

      JavaScriptÖÐÊý×é³£¼û²Ù×÷¼¼ÇÉ

      2017-09-04 12:04

    • springmvc ´«µÝºÍ½ÓÊÕÊý×é²ÎÊý

      springmvc ´«µÝºÍ½ÓÊÕÊý×é²ÎÊý

      2017-05-27 08:01

    • Ajax´«Êä¶ÔÏ󣬼¯ºÏ»òÊý×é¡£

      Ajax´«Êä¶ÔÏ󣬼¯ºÏ»òÊý×é¡£

      2017-03-08 14:00

    ÍøÓѵãÆÀ
    Ý