wwNameValueCollection::ToAttributeString

Creates an Attribute string of key value pairs like that can be used for HTML elements.

For example:

loCol = CREATEOBJECT("wwNameValueCollection")
loCol.Add("src","someimage.gif")
loCol.Add("valign","left")
loCol.Add("width","200")

lcHtml = "<img " + loCol.ToAttributeString() + " />"

produces:

<img src="someimage.gif" valign="left" width="200" height="200" >
o.ToAttributeString(lcSeparator)

Parameters

lcSeparator
An optional character that is used to separate the individual key value pairs. By default a space is used. Please note that the resulting string will have a trailing separator. Use a different value for example to create a query string (using & as a separator)

Remarks

Function works only with values that can be converted to string with the TRANSFORM() function. Objects will fail and cause a VFP error.


See also:

Class wwNameValueCollection

© West Wind Technologies, 1996-2024 • Updated: 04/04/17
Comment or report problem with topic