snippet-1495061186


View "Is_Numeric / Float Detection"
<h2>Background / Abount</h2> <p>I wasn't able to find a way to easily check whether or not a value was a Float or not. <code>isdigit()</code> didn't work, so I tried this logic. <h2>Sample <code>isdigit()</code> with Floats</h2> isdigit(1) = <mvt:eval expr="isdigit(1)" /><br/> isdigit(3.14) = <mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> <blockquote>3.14 is not a digit</blockquote> </mvt:if> <h2>Is_Numeric Logic &amp; Cases</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('-2,-1.5,-1,-0.5,0,000.000,0.5,1,1.5,2,3.14159,111111111,,000000-,-,!,@,#,$,%,^,a,b,c,d,-1.b,u.3' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:if expr="len(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;"</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 
View "Is_Numeric / Float Detection"
<h2>Background / Abount</h2> <p>I wasn't able to find a way to easily check whether or not a value was a Float or not. <code>isdigit()</code> didn't work, so I tried this logic. <h2>Sample <code>isdigit()</code> with Floats</h2> isdigit(1) = <mvt:eval expr="isdigit(1)" /><br/> isdigit(3.14) = <mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> <blockquote>3.14 is not a digit</blockquote> </mvt:if> <h2>Is_Numeric Logic &amp; Cases</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('-2,-1.5,-1,-0.5,0,0000000.0,0.5,1,1.5,2,111111111,,000000-,-,!,@,#,$,%,^,a,b,c,d,-1.b,u.3' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:if expr="len(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;"</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 

isDigit with Floats

Created: 1495065958
View "isDigit with Floats"
<h2>Background / Abount</h2> <p>I wasn't able to find a way to easily check whether or not a value was a Float or not. <code>isdigit()</code> didn't work, so I tried this logic. <h2>Sample <code>isdigit()</code> with Floats</h2> isdigit(1) = <mvt:eval expr="isdigit(1)" /><br/> isdigit(3.14) = <mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> <blockquote>3.14 is not a digit</blockquote> </mvt:if> <h2>Is_Numeric Logic &amp; Cases</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('-2,-1.5,-1,-0.5,0,0000000.0,0.5,1,1.5,2,111111111,,000000-,-,!,@,#,$,%,^,a,b,c,d,-1.b,u.3' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:if expr="len(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;"</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 

isDigit with Floats

Created: 1495064052
View "isDigit with Floats"
<h2>isDigit</h2> 1=<mvt:eval expr="isdigit(1)" /><br/> 3.14=<mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> 3.14 is not a digit </mvt:if> <h2>Custom isFloat</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('!,@,#,$,%,^,a,b,c,d,-1.b,u.3,111111111,-2,-1.5,-1,-0.5,0,0000000.0,0.5,1,1.5,2,,' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:if expr="len(l.settings:test) AND NOT isalpha(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;"</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 

isDigit with Floats

Created: 1495064041
View "isDigit with Floats"
<h2>isDigit</h2> 1=<mvt:eval expr="isdigit(1)" /><br/> 3.14=<mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> 3.14 is not a digit </mvt:if> <h2>Custom isFloat</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('!,@,#,$,%,^,a,b,c,d,-1.b,u.3,111111111,-2,-1.5,-1,-0.5,0,0000000.0,0.5,1,1.5,2,,' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:comment><mvt:assign name="l.settings:check" value="l.settings:test MOD 1" /> <mvt:if expr="l.settings:check NE 0"></mvt:comment> <mvt:if expr="len(l.settings:test) AND NOT isalpha(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;" (check: &mvt:check;)</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 

isDigit with Floats

Created: 1495063915
View "isDigit with Floats"
<h2>isDigit</h2> 1=<mvt:eval expr="isdigit(1)" /><br/> 3.14=<mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> 3.14 is not a digit </mvt:if> <h2>Custom isFloat</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('!,@,#,$,%,^,a,b,c,d,-1.b,u.3,111111111,-2,-1.5,-1,-0.5,0,0000000.0,0.5,1,1.5,2,,' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:comment><mvt:if expr="len(l.settings:test) AND NOT isalpha(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"></mvt:comment> <mvt:if expr="(l.settings:test MOD 1) NE 0"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;"</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 

isDigit with Floats

Created: 1495063773
View "isDigit with Floats"
<h2>isDigit</h2> 1=<mvt:eval expr="isdigit(1)" /><br/> 3.14=<mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> 3.14 is not a digit </mvt:if> <h2>Custom isFloat</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('!,@,#,$,%,^,a,b,c,d,-1.b,u.3,111111111,-2,-1.5,-1,-0.5,0,0000000.0,0.5,1,1.5,2,,' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:comment><mvt:assign name="l.settings:check" value="l.settings:test / l.settings:test" /> <mvt:if expr="l.settings:test EQ 0 OR l.settings:check EQ 1"></mvt:comment> <mvt:if expr="len(l.settings:test) AND NOT isalpha(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'pass'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'fail'" /> </mvt:if> <h2 style="color: &mvt:color;">&mvt:result;: &mvt:test;</h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>
 

isDigit with Floats

Created: 1495062102
View "isDigit with Floats"
<h2>isDigit</h2> 1=<mvt:eval expr="isdigit(1)" /><br/> 3.14=<mvt:eval expr="isdigit(3.14)" /><br/> <hr/> <mvt:assign name="g.char" value="''" /> <p>g.Char="&mvte:global:char;"</p> <p>int() - <mvt:eval expr="g.char - int(g.char)" /></p> <p>isalpha() - <mvt:eval expr="isalpha(g.char)" /></p> <mvt:if expr="len(g.char) AND NOT isalpha(g.char)"> Is Float <mvt:else> Is not float </mvt:if>
 

isDigit with Floats

Created: 1495061186
View "isDigit with Floats"
<h2>isDigit</h2> 1=<mvt:eval expr="isdigit(1)" /><br/> 3.14=<mvt:eval expr="isdigit(3.14)" /><br/>