Arrays From GetString

Results 1 to 3 of 3

Thread: Arrays From GetString

  1. #1
    Tom McLaren Guest

    Default Arrays From GetString

    Here&#039s a tricky one... I want to create an array from a database, using the speed of GetString.<BR>I have the following code:<BR><BR>dim tmpstr, tmpint<BR>tmpstr = rsFreq.GetString(,,", ", ", ")<BR>tmpint = len(tmpstr)<BR><BR>tmpint = tmpint - 2<BR>tmpstr = left(tmpstr,tmpint)<BR><BR>strarrayFreq = array(tmpstr)<BR><BR>Unfortunately this creates a comma seperated list as my first array element!! <BR><BR>Any ideas greatly appreciated...

  2. #2
    Cable Guest

    Default RE: Arrays From GetString

    I think you need to use the Split function, but you need ASP 2.0 or higher to use Split.<BR><BR>strarrayFreq = split(tmpstr,",")<BR><BR>The first parameter in the split function is the string that has the values in it. The second is the character or string that delimits (seperates) the values, in this case a comma.<BR><BR>It will generate strarrayFreq(0) for the first data and strarrayFreq(1) for the second, etc.

  3. #3
    Tom McLaren Guest

    Default RE: Arrays From GetString

    I&#039ve tried that, but I can&#039t get it to work, it just leaves me with strarrayFreq(0) containing everything... It works for a string that is declared e.g split("VBScriptxIsxFun!!", "x"), but not if you replace the literal declaration with a variable name.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts