<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>string | MaxVergelli.com</title>
	<atom:link href="https://www.maxvergelli.com/tag/string/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxvergelli.com</link>
	<description>sourcecode repository</description>
	<lastBuildDate>Tue, 07 Apr 2020 13:42:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i2.wp.com/www.maxvergelli.com/wp-content/uploads/2020/04/wp-1586823685141.png?fit=32%2C32&#038;ssl=1</url>
	<title>string | MaxVergelli.com</title>
	<link>https://www.maxvergelli.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">34603511</site>	<item>
		<title>Base64 encoding / decoding functions in VbScript / Classic ASP</title>
		<link>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/</link>
					<comments>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 06 Mar 2020 13:43:10 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[decoding]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vbscript]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=122</guid>

					<description><![CDATA[<p>With the following functions Base64Encode(sText) and Base64Decode(ByVal vCode), You can easly encode/decode a text in/from base64 in VBScript/Classic ASP:</p>
<p>The post <a href="https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/">Base64 encoding / decoding functions in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><span id="result_box" class="" lang="en">With the following functions <em>Base64Encode(sText)</em> and <em>Base64Decode(ByVal vCode)</em>, You can easly encode/decode a text in/from base64 in VBScript/Classic ASP:</span></p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function Base64Encode(sText)
  Dim oXML, oNode
  Set oXML = CreateObject(&quot;Msxml2.DOMDocument.3.0&quot;)
  Set oNode = oXML.CreateElement(&quot;base64&quot;)
  oNode.dataType = &quot;bin.base64&quot;
  oNode.nodeTypedValue = Stream_StringToBinary(sText)
  Base64Encode = oNode.text
  Set oNode = Nothing
  Set oXML = Nothing
End Function

Function Base64Decode(ByVal vCode)
  Dim oXML, oNode
  Set oXML = CreateObject(&quot;Msxml2.DOMDocument.3.0&quot;)
  Set oNode = oXML.CreateElement(&quot;base64&quot;)
  oNode.dataType = &quot;bin.base64&quot;
  oNode.text = vCode
  Base64Decode = Stream_BinaryToString(oNode.nodeTypedValue)
  Set oNode = Nothing
  Set oXML = Nothing
End Function

Private Function Stream_StringToBinary(Text)
  Const adTypeText = 2
  Const adTypeBinary = 1
  Dim BinaryStream 'As New Stream
  Set BinaryStream = CreateObject(&quot;ADODB.Stream&quot;)
  BinaryStream.Type = adTypeText
  BinaryStream.CharSet = &quot;us-ascii&quot;
  BinaryStream.Open
  BinaryStream.WriteText Text
  BinaryStream.Position = 0
  BinaryStream.Type = adTypeBinary
  BinaryStream.Position = 0
  Stream_StringToBinary = BinaryStream.Read
  Set BinaryStream = Nothing
End Function

Private Function Stream_BinaryToString(Binary)
  Const adTypeText = 2
  Const adTypeBinary = 1
  Dim BinaryStream 'As New Stream
  Set BinaryStream = CreateObject(&quot;ADODB.Stream&quot;)
  BinaryStream.Type = adTypeBinary
  BinaryStream.Open
  BinaryStream.Write Binary
  BinaryStream.Position = 0
  BinaryStream.Type = adTypeText
  BinaryStream.CharSet = &quot;us-ascii&quot;
  Stream_BinaryToString = BinaryStream.ReadText
  Set BinaryStream = Nothing
End Function</pre></div>



<p></p><p>The post <a href="https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/">Base64 encoding / decoding functions in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">122</post-id>	</item>
		<item>
		<title>How to export an ASP Associative Array to XML</title>
		<link>https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/</link>
					<comments>https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 15 Feb 2020 16:27:57 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=82</guid>

					<description><![CDATA[<p>&#8220;Asp Associative Array Class&#8221; provides a method to easly export all items to a well formatted XML string. For example, You can create a new *.ASP file : [sourcecode language=&#8221;vb&#8221;] &#60;!&#8211;#include file=&#34;AssociativeArrayClass.asp&#34; &#8211;&#62; &#60;% Dim Person, God Set Person = &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/" aria-label="How to export an ASP Associative Array to XML">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/">How to export an ASP Associative Array to XML</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://sourceforge.net/projects/asp-assoc-array/files/ASP_Associative_Array.rar/download" target="_blank" rel="noopener noreferrer">&#8220;Asp Associative Array Class&#8221;</a> provides a method to easly export all items to a well formatted XML string. For example, You can create a new *.ASP file :</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
&lt;!&#8211;#include file=&quot;AssociativeArrayClass.asp&quot; &#8211;&gt;<br />
&lt;%<br />
Dim Person, God<br />
Set Person = New AssociativeArray<br />
Set God = New AssociativeArray<br />
Person(&quot;name&quot;) = &quot;Max&quot;<br />
Person(&quot;surname&quot;) = &quot;Vergelli&quot;<br />
God(&quot;name&quot;) = &quot;Jesus&quot;<br />
God(&quot;surname&quot;) = &quot;Christ&quot;<br />
Dim World<br />
Set World = New AssociativeArray<br />
World(1) = Person<br />
World(2) = God<br />
response.Write World.ToXML()<br />
%&gt;<br />
[/sourcecode]</p>
<p>And You will get out the following XML:</p>
<p>[sourcecode language=&#8221;xml&#8221;]<br />
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;array&gt;<br />
      &lt;key&gt;<br />
            &lt;name&gt;&lt;![CDATA[1]]&gt;&lt;/name&gt;<br />
            &lt;value&gt;<br />
                    &lt;key&gt;<br />
                           &lt;name&gt;&lt;![CDATA[name]]&gt;&lt;/name&gt;<br />
                           &lt;value&gt;&lt;![CDATA[Max]]&gt;&lt;/value&gt;<br />
                    &lt;/key&gt;<br />
                    &lt;key&gt;<br />
                           &lt;name&gt;&lt;![CDATA[surname]]&gt;&lt;/name&gt;<br />
                           &lt;value&gt;&lt;![CDATA[Vergelli]]&gt;&lt;/value&gt;<br />
                   &lt;/key&gt;<br />
           &lt;/value&gt;<br />
      &lt;/key&gt;<br />
      &lt;key&gt;<br />
             &lt;name&gt;&lt;![CDATA[2]]&gt;&lt;/name&gt;<br />
             &lt;value&gt;<br />
                    &lt;key&gt;<br />
                           &lt;name&gt;&lt;![CDATA[name]]&gt;&lt;/name&gt;<br />
                           &lt;value&gt;&lt;![CDATA[Jesus]]&gt;&lt;/value&gt;<br />
                    &lt;/key&gt;<br />
                    &lt;key&gt;<br />
                          &lt;name&gt;&lt;![CDATA[surname]]&gt;&lt;/name&gt;<br />
                          &lt;value&gt;&lt;![CDATA[Christ]]&gt;&lt;/value&gt;<br />
                    &lt;/key&gt;<br />
             &lt;/value&gt;<br />
       &lt;/key&gt;<br />
&lt;/array&gt;<br />
[/sourcecode]</p><p>The post <a href="https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/">How to export an ASP Associative Array to XML</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">82</post-id>	</item>
		<item>
		<title>How to populate an ASP Associative Array with records from MySQL / Access database Table</title>
		<link>https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/</link>
					<comments>https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 08 Feb 2020 16:17:39 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=80</guid>

					<description><![CDATA[<p>In this example, You can learn how to populate an ASP Associative Array with the records of a database table (MS Access or MySQL); then, how to programmatically manage well structured data without any extra SQL. Before to start: For &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/" aria-label="How to populate an ASP Associative Array with records from MySQL / Access database Table">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/">How to populate an ASP Associative Array with records from MySQL / Access database Table</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>In this example, You can learn how to populate an ASP Associative Array with the records of a database table (MS Access or MySQL); then, how to programmatically manage well structured data without any extra SQL.</p>
<p><strong>Before to start:<br />
</strong>For this tutorial, You need to download this <a href="https://sourceforge.net/projects/asp-assoc-array/files/myDatabase_Example_for_Tutorial.mdb/download" target="_blank" rel="noopener noreferrer">MS Access database</a> example or You can create a new one in MySQL executing this SQL:</p>
<p>[sourcecode language=&#8221;sql&#8221;]<br />
CREATE TABLE `myTable` (<br />
`myField1` INT( 11 ) NOT NULL ,<br />
`myField2` VARCHAR( 255 ) NULL DEFAULT &#8216;test&#8217;,<br />
`myField3` VARCHAR( 255 ) NULL DEFAULT &#8216;test&#8217;,<br />
PRIMARY KEY ( `myField1` )<br />
) TYPE = MYISAM ;<br />
INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`)<br />
 VALUES(1, &#8216;rec1 Text2&#8217;, &#8216;rec1 Text3&#8217;);<br />
INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`)<br />
 VALUES(2, &#8216;rec2 Text2&#8217;, &#8216;rec2 Text3&#8217;);<br />
INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`)<br />
 VALUES(3, &#8216;rec3 Text2&#8217;, &#8216;rec3 Text3&#8217;);<br />
[/sourcecode]</p>
<p>Besides, to create an &#8220;AssociativeArray&#8221; object, You need to include the <a href="https://sourceforge.net/projects/asp-assoc-array/files/ASP_Associative_Array.rar/download" target="_blank" rel="noopener noreferrer">&#8220;ASP Associative Array Class&#8221;</a> file in your asp page with an include statement:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
&lt;!&#8211;#include file=&quot;AssociativeArrayClass.asp&quot; &#8211;&gt;<br />
[/sourcecode]</p>
<p><strong>Tutorial:</strong><br />
The target is to grab data from a database Table and save records in an Associative Array, then You need to create a Database connection by ADODB&#8230;</p>
<p>[sourcecode language=&#8221;vb&#8221;]Set DbConnection = Server.CreateObject(&quot;ADODB.Connection&quot;)[/sourcecode]</p>
<p>Select a Provider for MS Access or MySQL:</p>
<p>[sourcecode language=&#8221;vb&#8221;]dbConnectionString = _<br />
   &quot;driver={Microsoft Access Driver (*.mdb)}; DBQ=&quot; &amp; _<br />
           Server.MapPath(&quot;myDatabase.mdb&quot;)[/sourcecode]</p>
<p>For MySQL Databases You can also use a connection string like the following:</p>
<p>[sourcecode language=&#8221;vb&#8221;]&quot;driver={MySQL ODBC 3.51 Driver}; Server=; Uid=; Pwd=; Database=;&quot;[/sourcecode]</p>
<p>Open a database connection and create a SQL Select:</p>
<p>[sourcecode language=&#8221;vb&#8221;]DbConnection.Open dbConnectionString<br />
Dim sql : sql = &quot;SELECT * FROM myTable&quot;[/sourcecode]</p>
<p>Create and Populate the Associative Array with selected Records and close database connection:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Dim Table<br />
Set Table = New AssociativeArray<br />
Table.Fill DbConnection, sql<br />
Set DbConnection = Nothing[/sourcecode]</p>
<p><strong>Manage Records inside the Associative Array:</strong><br />
Right now, You can manage each record (and its values) inside the Associative Array. For example, You could get the first Record and its Values in each Field:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write( _<br />
                Table(0)(&quot;myField1&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(0)(&quot;myField2&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(0)(&quot;myField3&quot;) &amp; &quot;&lt;br /&gt;&quot;)[/sourcecode]</p>
<p>the following code gets the second Record and its Values in each Field:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write( _<br />
                Table(1)(&quot;myField1&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(1)(&quot;myField2&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(1)(&quot;myField3&quot;) &amp; &quot;&lt;br /&gt;&quot;)[/sourcecode]</p>
<p>it gets the total Records Count</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write(&quot;&lt;p&gt;Total Records: &quot; &amp; Table.Count &amp; &quot;&lt;/p&gt;&quot;)[/sourcecode]</p>
<p>this enumerates all Records inside the Associative Array:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write(&quot;&lt;ul&gt;&quot;)<br />
For Each row In Table.Items<br />
   Dim record<br />
   Set record = row.Value &#8216;get current Record Object<br />
   Response.Write(&quot;&lt;li&gt;&quot; &amp; record(&quot;myField1&quot;) &amp; &quot; : &quot; &amp; _<br />
                           record(&quot;myField2&quot;) &amp; &quot; : &quot; &amp; _<br />
                           record(&quot;myField3&quot;) &amp; &quot;&lt;/li&gt;&quot;)<br />
Next<br />
Response.Write(&quot;&lt;/ul&gt;&quot;)[/sourcecode]</p>
<p>and finally it gets all records by index (zero-based):</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write(&quot;&lt;ul&gt;&quot;)<br />
For n = 0 To Table.Count &#8211; 1<br />
     Response.Write(&quot;&lt;li&gt;&quot; &amp; Table(n)(&quot;myField1&quot;) &amp; &quot; : &quot; &amp; _<br />
                             Table(n)(&quot;myField2&quot;) &amp; &quot; : &quot; &amp; _<br />
                             Table(n)(&quot;myField3&quot;) &amp; &quot;&lt;/li&gt;&quot;)<br />
Next<br />
Response.Write(&quot;&lt;/ul&gt;&quot;)[/sourcecode]</p>
<p>That&#8217;s all,<br />
Get the full example at <a href="http://sourceforge.net/projects/asp-assoc-array/">http://sourceforge.net/projects/asp-assoc-array/</a></p>
<p>Max</p><p>The post <a href="https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/">How to populate an ASP Associative Array with records from MySQL / Access database Table</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">80</post-id>	</item>
		<item>
		<title>How to use Associative Arrays in ASP</title>
		<link>https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/</link>
					<comments>https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 01 Feb 2020 16:03:13 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[isarray-function]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=78</guid>

					<description><![CDATA[<p>First of all, You need to download the &#8220;Asp Associative Array class&#8221; then include the file &#8220;AssociativeArrayClass.asp&#8221; in your asp page. Right now, You can start declaring associative arrays in ASP with the following syntax: [sourcecode language=&#8221;vb&#8221;] Dim Person Set &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/" aria-label="How to use Associative Arrays in ASP">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/">How to use Associative Arrays in ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>First of all, You need to download the <a href="http://sourceforge.net/projects/asp-assoc-array/">&#8220;Asp Associative Array class&#8221;</a> then include the file &#8220;AssociativeArrayClass.asp&#8221; in your asp page.</p>
<p>Right now, You can start declaring associative arrays in ASP with the following syntax:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Dim Person<br />
Set Person = New AssociativeArray<br />
Person(&quot;name&quot;)    =   &quot;Max&quot;<br />
Person(&quot;surname&quot;) =   &quot;Vergelli&quot;<br />
Response.Write Person(&quot;name&quot;) &amp; &quot; &quot; &amp; Person(&quot;surname&quot;)<br />
[/sourcecode]</p>
<p>In the above example, the key &#8220;name&#8221; in &#8220;Person&#8221; object, stores &#8220;Max&#8221; value. You can set strings or integers for the key and <strong>any object/variant type for the relative value</strong>. However, You can not set key with Null or &#8220;&#8221; strings like the following:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
&#8216;invalid keys&#8230;<br />
Person(Null) = &quot;Null Key&quot;<br />
Person(&quot;&quot;) = &quot;Empty String&quot;<br />
Dim undefined<br />
Person(undefined) = &quot;Variable Not Initialized&quot;<br />
Response.Write Person(&quot;&quot;) &amp; Person(Null) &amp; Person(undefined)<br />
[/sourcecode]</p>
<p><strong>How to get every item of the associative array:</strong><br />
You can make a &#8220;For Each&#8221; loop on the array like in the following code</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
For Each element In Person.Items<br />
   Response.Write element.Key &amp; &quot; : &quot; &amp; element.Value &amp; vbCrLf<br />
Next<br />
[/sourcecode]</p>
<p>&#8220;Person.Items&#8221; gets all the items inside the associative array and for each item You can get &#8220;Key&#8221; and &#8220;Value&#8221; properties.</p>
<p><strong>How to copy an associative array:</strong></p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Dim Person_Clone             &#8216;it&#8217;s a Variant type<br />
Set Person_Clone = Person    &#8216;NOTE: Use &quot;Set&quot; statement!<br />
&#8216;print values<br />
Response.Write Person_Clone(&quot;name&quot;) &amp; &quot; &quot; &amp; Person_Clone(&quot;surname&quot;) &amp; vbCrLf<br />
&#8216;get each key/value<br />
For Each element In Person_Clone.Items<br />
   Response.Write element.Key &amp; &quot; : &quot; &amp; element.Value &amp; vbCrLf<br />
Next<br />
[/sourcecode]</p>
<p><strong>How to create nested associative arrays&#8230;</strong><br />
You can create infinite nested associative arrays and accessing them like the following:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Dim Person<br />
Set Person = New AssociativeArray<br />
Person(&quot;name&quot;) = &quot;Max&quot;<br />
Person(&quot;surname&quot;) = &quot;Vergelli&quot;<br />
Dim People<br />
Set People = New AssociativeArray<br />
People(1) = Person<br />
People(2) = Person<br />
People(3) = Person<br />
Response.Write People(1)(&quot;name&quot;) &amp; &quot; &quot; &amp; People(1)(&quot;surname&quot;)<br />
[/sourcecode]</p>
<p>Besides, You can enumerate all the keys/values inside the &#8220;People&#8221; associative array object</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
For Each element In People.Items<br />
   Dim el_person<br />
   Set el_person = element.Value<br />
   Response.Write el_person(&quot;name&quot;) &amp; &quot; : &quot; &amp; el_person(&quot;surname&quot;) &amp; vbCrLf<br />
Next<br />
[/sourcecode]</p><p>The post <a href="https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/">How to use Associative Arrays in ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">78</post-id>	</item>
		<item>
		<title>VBScript Class to create easly Associative Arrays in ASP like in PHP</title>
		<link>https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/</link>
					<comments>https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 22 Jan 2020 15:53:47 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[datatype]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[ms-access]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[structure]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=76</guid>

					<description><![CDATA[<p>I&#8217;ve posted a project at Source Forge with an ASP/VBScript class to create easly associative arrays like in PHP; visit http://sourceforge.net/projects/asp-assoc-array/ It is possible also load in an associative-array the data coming from MySQL or MS Access databases, then You &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/" aria-label="VBScript Class to create easly Associative Arrays in ASP like in PHP">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/">VBScript Class to create easly Associative Arrays in ASP like in PHP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve posted a project at Source Forge with an ASP/VBScript class to create easly associative arrays like in PHP; visit <a href="http://sourceforge.net/projects/asp-assoc-array/">http://sourceforge.net/projects/asp-assoc-array/</a></p>
<p>It is possible also load in an associative-array the data coming from MySQL or MS Access databases, then You can programmatically manage the structured data; You can also export associative arrays to XML.</p>
<p>Associative arrays are usefull when it is necessary manage many variables at once (for example when we pass multiple values at once to a method/function) or just to store data in a well structured array and reusing  its values anytime.</p><p>The post <a href="https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/">VBScript Class to create easly Associative Arrays in ASP like in PHP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">76</post-id>	</item>
		<item>
		<title>Online JSON Validator</title>
		<link>https://www.maxvergelli.com/online-json-validator/</link>
					<comments>https://www.maxvergelli.com/online-json-validator/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 15:16:20 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[structure]]></category>
		<category><![CDATA[validator]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=61</guid>

					<description><![CDATA[<p>If You are bored of having to test many JSON structures in JavaScript, You can validate your JSON data with this useful online tool: http://jsonlint.com/</p>
<p>The post <a href="https://www.maxvergelli.com/online-json-validator/">Online JSON Validator</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>If You are bored of having to test many JSON structures in JavaScript, You can validate your JSON data with this useful online tool: <a href="http://jsonlint.com/">http://jsonlint.com/</a> </p><p>The post <a href="https://www.maxvergelli.com/online-json-validator/">Online JSON Validator</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/online-json-validator/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">61</post-id>	</item>
		<item>
		<title>PHP Date or Datetime to MySQL Datetime and viceversa</title>
		<link>https://www.maxvergelli.com/php-date-or-datetime-to-mysql-datetime-and-viceversa/</link>
					<comments>https://www.maxvergelli.com/php-date-or-datetime-to-mysql-datetime-and-viceversa/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 21 Dec 2019 15:10:11 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[conversione]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-datetime]]></category>
		<category><![CDATA[mysql-datetime-conversion]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=59</guid>

					<description><![CDATA[<p>Two useful PHP functions to convert normal date/datetime (&#8220;25.12.2010 12:10:00&#8221; or &#8220;25.12.2010&#8221;) to MySQL datetime (like &#8220;2010-12-25 12:10:00&#8221; or &#8220;2010-12-25 00:00:00&#8243;); You can get back a date/datetime from MySQL datetime too: [sourcecode language=&#8221;php&#8221;] function datetime2mysqldatetime($datetime){ // &#8216;25.12.2010 12:10:00&#8217; -&#62; &#8216;2010-12-25 &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/php-date-or-datetime-to-mysql-datetime-and-viceversa/" aria-label="PHP Date or Datetime to MySQL Datetime and viceversa">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/php-date-or-datetime-to-mysql-datetime-and-viceversa/">PHP Date or Datetime to MySQL Datetime and viceversa</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Two useful PHP functions to convert normal date/datetime (&#8220;25.12.2010 12:10:00&#8221; or &#8220;25.12.2010&#8221;) to MySQL datetime (like &#8220;2010-12-25 12:10:00&#8221; or &#8220;2010-12-25 00:00:00&#8243;); You can get back a date/datetime from MySQL datetime too:</p>
<p>[sourcecode language=&#8221;php&#8221;]<br />
	function datetime2mysqldatetime($datetime){				// &#8216;25.12.2010 12:10:00&#8217; -&gt; &#8216;2010-12-25 12:10:00&#8217;<br />
		return date(&#8216;Y-m-d H:i:s&#8217;, strtotime($datetime)); 	// &#8216;25.12.2010&#8217; 		 -&gt; &#8216;2010-12-25 00:00:00&#8217;<br />
	}</p>
<p>	function mysqldatetime2datetime($mysql_datetime){	// &#8216;2010-12-25 12:10:00&#8217; -&gt; &#8216;25.12.2010 12:10:00&#8217;<br />
		$d = split(&#8216; &#8216;, $mysql_datetime);				// &#8216;2010-12-25&#8217; 		 -&gt; &#8216;25.12.2010&#8217;<br />
		if($d &amp;&amp; count($d)&gt;1){<br />
			list($year, $month, $day) = split(&#8216;-&#8216;, $d[0]);<br />
			list($hour, $minute, $second) = split(&#8216;:&#8217;, $d[1]);<br />
			$d = date(&#8216;d.m.Y H:i:s&#8217;, mktime($hour, $minute, $second, $month, $day, $year));}<br />
		else if($d &amp;&amp; count($d)==1){<br />
			list($year, $month, $day) = split(&#8216;-&#8216;, $d[0]);<br />
			$d = date(&#8216;d.m.Y&#8217;, mktime(0, 0, 0, $month, $day, $year));<br />
		} else {<br />
			$d = NULL;<br />
		}<br />
		return $d;<br />
	}<br />
[/sourcecode]</p>
<p>Max 🙂</p><p>The post <a href="https://www.maxvergelli.com/php-date-or-datetime-to-mysql-datetime-and-viceversa/">PHP Date or Datetime to MySQL Datetime and viceversa</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/php-date-or-datetime-to-mysql-datetime-and-viceversa/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">59</post-id>	</item>
		<item>
		<title>Easy-to-use and strong Encrypt/Decrypt PHP functions</title>
		<link>https://www.maxvergelli.com/easy-to-use-strong-encrypt-decrypt-php-functions/</link>
					<comments>https://www.maxvergelli.com/easy-to-use-strong-encrypt-decrypt-php-functions/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Tue, 10 Dec 2019 15:04:26 +0000</pubDate>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hashing]]></category>
		<category><![CDATA[MD5]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rijndael]]></category>
		<category><![CDATA[SHA1]]></category>
		<category><![CDATA[SHA256]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[String-class]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=57</guid>

					<description><![CDATA[<p>I wrote those two following PHP functions to encrypt and decrypt strings easly and with a stronger encryption module than the other examples on the net (please, note that &#8220;strong&#8221; does not equals &#8220;secure&#8221;!); Happy encryption/decryption! 🙂 Max [sourcecode language=&#8221;php&#8221;] &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/easy-to-use-strong-encrypt-decrypt-php-functions/" aria-label="Easy-to-use and strong Encrypt/Decrypt PHP functions">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/easy-to-use-strong-encrypt-decrypt-php-functions/">Easy-to-use and strong Encrypt/Decrypt PHP functions</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I wrote those two following PHP functions to encrypt and decrypt strings easly and with a stronger encryption module than the other examples on the net (please, note that &#8220;strong&#8221; does not equals &#8220;secure&#8221;!);</p>
<p>Happy encryption/decryption! 🙂</p>
<p>Max</p>
<p>[sourcecode language=&#8221;php&#8221;]<br />
	function encrypt($input_string, $key){<br />
		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);<br />
		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);<br />
		$h_key = hash(&#8216;sha256&#8217;, $key, TRUE);<br />
		return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $h_key, $input_string, MCRYPT_MODE_ECB, $iv));<br />
	}</p>
<p>	function decrypt($encrypted_input_string, $key){<br />
		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);<br />
		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);<br />
		$h_key = hash(&#8216;sha256&#8217;, $key, TRUE);<br />
		return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $h_key, base64_decode($encrypted_input_string), MCRYPT_MODE_ECB, $iv));<br />
	}<br />
[/sourcecode]</p><p>The post <a href="https://www.maxvergelli.com/easy-to-use-strong-encrypt-decrypt-php-functions/">Easy-to-use and strong Encrypt/Decrypt PHP functions</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/easy-to-use-strong-encrypt-decrypt-php-functions/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">57</post-id>	</item>
		<item>
		<title>Javascript isArray() function</title>
		<link>https://www.maxvergelli.com/javascript-isarray-function/</link>
					<comments>https://www.maxvergelli.com/javascript-isarray-function/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 01 Nov 2019 14:50:42 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[datatype]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[isarray-function]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[typeof]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=55</guid>

					<description><![CDATA[<p>Javascript does not provide a function to recognize if a variable is an array or not; you can make a &#8220;typeof&#8221; of the variable however u&#8217;ll get an &#8216;object&#8217; datatype, as in the following code [sourcecode language=&#8221;javascript&#8221;] var myarray = &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/javascript-isarray-function/" aria-label="Javascript isArray() function">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/javascript-isarray-function/">Javascript isArray() function</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Javascript does not provide a function to recognize if a variable is an array or not; you can make a &#8220;typeof&#8221; of the variable however u&#8217;ll get an &#8216;object&#8217; datatype, as in the following code<br />
[sourcecode language=&#8221;javascript&#8221;]<br />
var myarray = [1, 2, 3];<br />
var myobject = { key: &#8216;value&#8217; };<br />
alert(typeof myarray); //return &#8216;object&#8217;<br />
alert(typeof myobject); //return &#8216;object&#8217;<br />
[/sourcecode]</p>
<p>to recognize a data type &#8216;object&#8217; from &#8216;array&#8217;, you need a specialized function like this&#8230;<br />
[sourcecode language=&#8221;javascript&#8221;]<br />
function isArray(value){<br />
	var b = typeof value;<br />
	if(b === &#8216;object&#8217;){<br />
		if(value){<br />
			b = (typeof value.length === &#8216;number&#8217; &amp;&amp;<br />
				!(value.propertyIsEnumerable(&#8216;length&#8217;)) &amp;&amp;<br />
				typeof value.splice === &#8216;function&#8217;) ? true : false;<br />
		}else{<br />
			b = false;<br />
		};<br />
	};<br />
	return b;<br />
};<br />
var myarray = [1, 2, 3];<br />
var myobject = { key: &#8216;value&#8217; };<br />
alert(isArray(myarray)); //return true<br />
alert(isArray(myobject)); //return false<br />
[/sourcecode]</p>
<p>Good work!<br />
Max 🙂</p><p>The post <a href="https://www.maxvergelli.com/javascript-isarray-function/">Javascript isArray() function</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/javascript-isarray-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">55</post-id>	</item>
		<item>
		<title>How to stringify an object in Javascript: converting an object to a padded &#038; well-formatted string or simply inline</title>
		<link>https://www.maxvergelli.com/how-to-stringify-an-object-in-javascript-converting-an-object-to-a-padded-well-formatted-string-or-simply-inline/</link>
					<comments>https://www.maxvergelli.com/how-to-stringify-an-object-in-javascript-converting-an-object-to-a-padded-well-formatted-string-or-simply-inline/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Tue, 01 Oct 2019 14:45:36 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[stringification]]></category>
		<category><![CDATA[stringify]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=53</guid>

					<description><![CDATA[<p>I wrote a function to convert an object in a string (stringification) without using a JSON library; you can convert an object to a well formatted string with padding or simply to an unique line: [sourcecode language=&#8221;javascript&#8221;] function stringify(object, padding, &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-stringify-an-object-in-javascript-converting-an-object-to-a-padded-well-formatted-string-or-simply-inline/" aria-label="How to stringify an object in Javascript: converting an object to a padded &#038; well-formatted string or simply inline">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-stringify-an-object-in-javascript-converting-an-object-to-a-padded-well-formatted-string-or-simply-inline/">How to stringify an object in Javascript: converting an object to a padded & well-formatted string or simply inline</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I wrote a function to convert an object in a string (stringification) without using a JSON library; you can convert an object to a well formatted string with padding or simply to an unique line:</p>
<p>[sourcecode language=&#8221;javascript&#8221;]<br />
function stringify(object, padding, margin){<br />
	var o = (typeof object == &#8216;object&#8217; || typeof object == &#8216;function&#8217;) &amp;&amp; object != null ? object : null;<br />
	var p = typeof padding == &#8216;boolean&#8217; &amp;&amp; padding ? true : false;<br />
	var m = typeof margin == &#8216;number&#8217; &amp;&amp; margin&gt;0 &amp;&amp; p ? margin : 0;<br />
	if(o != null){<br />
		var s = &#8221;;<br />
		var a = function(o){return (typeof o === &#8216;object&#8217; &amp;&amp; o ? ((typeof o.length === &#8216;number&#8217; &amp;&amp;!(o.propertyIsEnumerable(&#8216;length&#8217;)) &amp;&amp; typeof o.splice === &#8216;function&#8217;) ? true : false) : false);}; //is array?<br />
		for(var v in o){<br />
			s += typeof o[v] === &#8216;object&#8217; ? (o[v] ? (<br />
					(typeof o[v].length === &#8216;number&#8217; &amp;&amp; !(o[v].propertyIsEnumerable(&#8216;length&#8217;)) &amp;&amp; typeof o[v].splice === &#8216;function&#8217;) ?<br />
					(m&gt;0 ? Array(m).join(&#8216; &#8216;):&#8221;) + v + &#8216;:&#8217; + (p ? &#8216; &#8216;:&#8221;) + &#8216;[&#8216; + (p ? &#8216;rn&#8217;:&#8221;) + stringify(o[v],p,(m&gt;0?m:1)+v.length+4) + (p!=true ? &#8221; : &#8216;rn&#8217; + Array((m&gt;0?m:1)+v.length+2).join(&#8216; &#8216;)) + &#8216;],&#8217; + (p ? &#8216;rn&#8217;:&#8221;) :<br />
					(m&gt;0 ? Array(m).join(&#8216; &#8216;):&#8221;) + v + &#8216;:&#8217; + (p ? &#8216; &#8216;:&#8221;) + &#8216;{&#8216; + (p ? &#8216;rn&#8217;:&#8221;) + stringify(o[v],p,(m&gt;0?m:1)+v.length+4) + (p!=true ? &#8221; : &#8216;rn&#8217; + Array((m&gt;0?m:1)+v.length+2).join(&#8216; &#8216;)) + &#8216;},&#8217; + (p ? &#8216;rn&#8217;:&#8221;)<br />
				) : (m&gt;0 ? Array(m).join(&#8216; &#8216;):&#8221;) + v + &#8216;:&#8217; + (p ? &#8216; &#8216;:&#8221;) + o[v] + &#8216;,&#8217; + (p ? &#8216;rn&#8217;:&#8221;))<br />
			: (m&gt;0 ? Array(m).join(&#8216; &#8216;):&#8221;) + v + &#8216;:&#8217; + (p ? &#8216; &#8216;:&#8221;) + (typeof o[v] == &#8216;string&#8217; ? &#8221;&#8217; + o[v].replace(/&#8217;/g,&#8217;\&#8221;) + &#8221;&#8217; : o[v]) + &#8216;,&#8217; + (p ? &#8216;rn&#8217;:&#8221;);<br />
		};<br />
		o = s.length&gt;0 &amp;&amp; p!=true ? s.substring(0, s.length-1) : (s.length&gt;2 ? s.substring(0, s.length-3) : s);<br />
	}else{<br />
		o = object;<br />
	};<br />
	return o;<br />
};<br />
[/sourcecode]</p>
<p><strong>a little example, you declare same variable&#8230;.</strong></p>
<p>[sourcecode language=&#8221;javascript&#8221;]<br />
var associative_array = new Array();<br />
associative_array[&#8216;one&#8217;] = 1;<br />
associative_array[&#8216;two&#8217;] = 2;<br />
associative_array[&#8216;undefinedvar&#8217;];</p>
<p>var myobject = {<br />
					mystring: &#8216;value&#8217;,<br />
					myquoted: &#8216;string with &#8216;single quotation mark&#8221;,<br />
					mynumber: 1,<br />
					myboolean: true,<br />
					myarray: [1, 2, 3],<br />
					myassocarray: associative_array,<br />
					myobject: {<br />
								obj_string: &#8216;hi!&#8217;,<br />
								obj_number: 1,<br />
								obj_array: [<br />
												&#8216;just&#8217;, &#8216;a&#8217;, &#8216;test&#8217;, 1, false,<br />
												[&#8216;array&#8217;, &#8216;inside&#8217;, &#8216;array&#8217;],<br />
												{<br />
													object: &#8216;inside array&#8217;,<br />
													array: [1,2,3,4,5,6,7,8,9]<br />
												},</p>
<p>											]<br />
								},<br />
					mynullvalue: null,<br />
					myundefined: associative_array[&#8216;undefinedvar&#8217;],<br />
					myfunction: function(){ var s = &#8216;hello!&#8217;; return s; }<br />
				};<br />
[/sourcecode]</p>
<p><strong>then, for an inline stringification, you can use</strong></p>
<p>[sourcecode language=&#8221;javascript&#8221;]<br />
var str = stringify(myobject);<br />
[/sourcecode]</p>
<p><strong>and &#8220;str&#8221; value will be a string as</strong></p>
<p>[sourcecode language=&#8221;javascript&#8221;]<br />
mystring:&#8217;value&#8217;,myquoted:&#8217;string with &#8216;single quotation mark&#8221;,mynumber:1,myboolean:true,myarray:[0:1,1:2,2:3],myassocarray:[one:1,two:2],myobject:{obj_string:&#8217;hi!&#8217;,obj_number:1,obj_array:[0:&#8217;just&#8217;,1:&#8217;a&#8217;,2:&#8217;test&#8217;,3:1,4:false,5:[0:&#8217;array&#8217;,1:&#8217;inside&#8217;,2:&#8217;array&#8217;],6:{object:&#8217;inside array&#8217;,array:[0:1,1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9]}]},mynullvalue:null,myundefined:undefined,myfunction:function () {<br />
    var s = &quot;hello!&quot;;<br />
    return s;<br />
}<br />
[/sourcecode]</p>
<p><strong>Instead, for a stringification with a well formatted padding, you can use</strong></p>
<p>[sourcecode language=&#8221;javascript&#8221;]<br />
var str_formatted = stringify(myobject, true);<br />
[/sourcecode]</p>
<p><strong>and this is the &#8220;str_formatted&#8221; value:</strong></p>
<p>[sourcecode language=&#8221;javascript&#8221;]<br />
mystring: &#8216;value&#8217;,<br />
myquoted: &#8216;string with &#8216;single quotation mark&#8221;,<br />
mynumber: 1,<br />
myboolean: true,<br />
myarray: [<br />
           0: 1,<br />
           1: 2,<br />
           2: 3<br />
         ],<br />
myassocarray: [<br />
                one: 1,<br />
                two: 2<br />
              ],<br />
myobject: {<br />
            obj_string: &#8216;hi!&#8217;,<br />
            obj_number: 1,<br />
            obj_array: [<br />
                         0: &#8216;just&#8217;,<br />
                         1: &#8216;a&#8217;,<br />
                         2: &#8216;test&#8217;,<br />
                         3: 1,<br />
                         4: false,<br />
                         5: [<br />
                              0: &#8216;array&#8217;,<br />
                              1: &#8216;inside&#8217;,<br />
                              2: &#8216;array&#8217;<br />
                            ],<br />
                         6: {<br />
                              object: &#8216;inside array&#8217;,<br />
                              array: [<br />
                                       0: 1,<br />
                                       1: 2,<br />
                                       2: 3,<br />
                                       3: 4,<br />
                                       4: 5,<br />
                                       5: 6,<br />
                                       6: 7,<br />
                                       7: 8,<br />
                                       8: 9<br />
                                     ]<br />
                            }<br />
                       ]<br />
          },<br />
mynullvalue: null,<br />
myundefined: undefined,<br />
myfunction: function () {<br />
    var s = &quot;hello!&quot;;<br />
    return s;<br />
}<br />
[/sourcecode]</p>
<p>Finally, when you pass a variable to stringify() that is not an object, it will just return the value.</p>
<p>Happy stringifications!</p>
<p>Max 🙂</p><p>The post <a href="https://www.maxvergelli.com/how-to-stringify-an-object-in-javascript-converting-an-object-to-a-padded-well-formatted-string-or-simply-inline/">How to stringify an object in Javascript: converting an object to a padded & well-formatted string or simply inline</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-stringify-an-object-in-javascript-converting-an-object-to-a-padded-well-formatted-string-or-simply-inline/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">53</post-id>	</item>
	</channel>
</rss>
