[AccessD] Treat string as array

A.D.Tejpal adtp at airtelmail.in
Tue Mar 25 12:08:30 CDT 2008


    Thanks Gustav. The thread had already been resolved vide your excellent suggestion regarding use of StrConv() function with vbFromUnicode as the argument.

    Both the alternatives address the point originally raised by John.

Best wishes,
A.D.Tejpal
------------

  ----- Original Message ----- 
  From: Gustav Brock 
  To: accessd at databaseadvisors.com 
  Sent: Tuesday, March 25, 2008 13:12
  Subject: Re: [AccessD] Treat string as array


  Hi A.D.

  Very creative solution!

  For how long time will JC chew on this dry stick? Next step is probably that the spaces he specified originally which should not be present should be present anyway or perhaps replaced by a tab or a white space! Lots of options out there ...

  /gustav

  >>> adtp at airtelmail.in 25-03-2008 08:06 >>>

      A very concise version of Function Fn_ConvStringToArray(), using only a single statement, is placed below. It returns an array, so that individual characters of input string get placed in individual elements of the array.

      Note - In fact, right side of assignment statement (A) below, can be used directly, as it is made up purely of access built-in functions. Fn_ConvStringToArray() acts merely as a wrapper function, for sake of convenience.

  A.D.Tejpal
  ------------

  ' Code to be placed in VBA module
  '================================
  Function Fn_ConvStringToArray(StrInput _
                                  As String) As Variant
      Fn_ConvStringToArray = _
                  Split(Format(StrInput, _
                  Mid(Replace(String(Len(StrInput), _
                  "~"), "~", "~@"), 2)), "~")                         ' (A)
  End Function
  '================================


More information about the AccessD mailing list