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. JavaScript
  4. Please help urgent Conversion of string to array

Please help urgent Conversion of string to array

Scheduled Pinned Locked Moved JavaScript
csharpjavascriptdata-structureshelp
2 Posts 2 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.
  • C Offline
    C Offline
    Chandra Sekhar bs
    wrote on last edited by
    #1

    this is in C# string q = " {label:\"January\",value:\"1\" } , {label:\"Feburary\",value:\"2\"}"; i want to convert this into an array in javascript function(data){ this is where i need array data is nothing but string q } Please help urgent Chandra Sekhar

    T 1 Reply Last reply
    0
    • C Chandra Sekhar bs

      this is in C# string q = " {label:\"January\",value:\"1\" } , {label:\"Feburary\",value:\"2\"}"; i want to convert this into an array in javascript function(data){ this is where i need array data is nothing but string q } Please help urgent Chandra Sekhar

      T Offline
      T Offline
      twseitex
      wrote on last edited by
      #2

      IE String Object (literal) (JScript) Allows manipulation and formatting of text strings and determination and location of substrings within strings. String is not a collection and not array. Use operator + or method concat. To convert a JScript-string into array use method split. To convert a numeric value into String use method parseInt. Syntax newString = new String(["stringLiteral"]) Arguments newString Required. The variable name to which the String object is assigned. stringLiteral Optional. Any group of Unicode characters. Remarks String objects can be created implicitly using string literals. String objects created in this fashion (referred to as standard strings) are treated differently than String objects created using the new operator. All string literals share a common, global string object. If a property is added to a string literal, it is available to all standard string objects: var alpha, beta; alpha = "This is a string"; beta = "This is also a string"; alpha.test = 10; In the previous example, test is now defined for beta and all future string literals. In the following example, however, added properties are treated differently: var gamma, delta; gamma = new String("This is a string"); delta = new String("This is also a string"); gamma.test = 10; In this case, test is not defined for delta. Each String object declared as a new String object has its own set of members. This is the only case where String objects and string literals are handled differently. Properties constructor length prototype Methods anchor big blink bold charAt charCodeAt concat fixed fontcolor fontsize fromCharCode indexOf italics lastIndexOf link match replace search slice small split strike sub substr substring sup toLowerCase toUpperCase toString valueOf Examples // A primitive string. var string1 = "Hello"; // Two distinct String objects with the same value. var StringObject1 = new String(string1); var StringObject2 = new String(string1); // An object converts to a primitive when // comparing an object and a primitive. print(string1 == StringObject1); // Prints true. // Two distinct objects compare as different. print(StringObject1 == StringObject2); // Prints false. // Use the toString() or valueOf() methods to compare object values. print(StringObject1.valueOf() == StringObject2); // Prints true. length Property (String) Returns the length of a String object. strVariable.length "

      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