Results 1 to 2 of 2

Thread: astring - astore

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    239

    astring - astore

    is there any way to prevent type changing while using astring() - astore()?
    Code:
    declare a[2]
    a[1] = "a"
    a[2] = 2.0
    ?type("a[2]") 	// N
    x = astring(a,",")
    =astore(aa,x,",")
    ?type("aa[2]") 	// C

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,164
    Blog Entries
    22
    No it treats all items in the comma separated list as character strings.

    Code:
    for I=1 to alen(a)
      if isdigit(a[i])
        a[i] = val(a[i])
      endif
    endfor
    You may want to look at json_encode() / json_decode() and metadata_encode() / metadata_decode() also.
    Last edited by barrymavin; 2020-11-05 at 21:45.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us