Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. split function in java script

split function in java script

Scheduled Pinned Locked Moved ASP.NET
javatoolshelpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonia Gupta
    wrote on last edited by
    #1

    var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;i

    A J 2 Replies Last reply
    0
    • S Sonia Gupta

      var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;i

      A Offline
      A Offline
      Arindam Tewary
      wrote on last edited by
      #2

      Split returns an array of string .... problem is in 2 nd line !!!!

      Thanks, Arindam D Tewary

      S 1 Reply Last reply
      0
      • A Arindam Tewary

        Split returns an array of string .... problem is in 2 nd line !!!!

        Thanks, Arindam D Tewary

        S Offline
        S Offline
        Sonia Gupta
        wrote on last edited by
        #3

        if i write alert(abc[0]); it is working fine. What's the problem in loop then?

        Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

        A A 2 Replies Last reply
        0
        • S Sonia Gupta

          if i write alert(abc[0]); it is working fine. What's the problem in loop then?

          Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

          A Offline
          A Offline
          Arindam Tewary
          wrote on last edited by
          #4

          try ... var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;ilength-1;i++) { alert(def[i]); }

          Thanks, Arindam D Tewary

          1 Reply Last reply
          0
          • S Sonia Gupta

            var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;i

            J Offline
            J Offline
            J4amieC
            wrote on last edited by
            #5

            Sonia Gupta wrote:

            for(int i=0;i<def.length;i++) {

            there is no int in javascript, you want for (**var** i=0;i<def.length;i++)

            --- How to get answers to your questions[^]

            1 Reply Last reply
            0
            • S Sonia Gupta

              if i write alert(abc[0]); it is working fine. What's the problem in loop then?

              Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

              A Offline
              A Offline
              Arif patel
              wrote on last edited by
              #6

              Hi sonia, To split a string, use the substring method: string.substring(start,end) Here string is the string from which you want to extract a substring. start is the number specifying the position of the character at which the substring begins. (The character at start itself will be included in the substring.) end is the number specifying the position of the character at which the substring ends. (The character at end will not be included in the substring.) Note that the first character in the string corresponds to position 0, and the last character to position string.length-1. Examples: 'Hello'.substring(0,2) // 'He' 'Hello'.substring(0,4) // 'Hell' Regards, S.Arif patel.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups