18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

Sqr<br />

Function Returns the square root of a number.<br />

Usage val = Sqr(number)<br />

Arguments number<br />

The number argument can be any valid numeric expression greater than or equal to 0.<br />

Return Returns the square root of a number.<br />

Example Dim MySqr<br />

MySqr = Sqr(4) ' Returns 2.<br />

MySqr = Sqr(23) ' Returns 4.79583152331272.<br />

MySqr = Sqr(0) ' Returns 0.<br />

MySqr = Sqr(-4) ' Generates a run-time error.<br />

StrComp<br />

Description Per<strong>for</strong>ms a string comparison and returns the result.<br />

Usage intVal = StrComp(string1, string2[, compare])<br />

Arguments string1<br />

Required. Any valid string expression.<br />

string2<br />

Required. Any valid string expression.<br />

compare<br />

Optional. Numeric value indicating the comparison method to use when evaluating strings. If<br />

omitted, a binary comparison is per<strong>for</strong>med. See Settings section <strong>for</strong> values.<br />

Settings The compare argument can have the following values:<br />

Constant Value Description<br />

vbBinaryCompare 0 Per<strong>for</strong>m a binary comparison.<br />

vbTextCompare 1 Per<strong>for</strong>m a textual comparison<br />

Return An Integer. The StrComp function has the following return values:<br />

If StrComp returns<br />

string1 is less than string2 -1<br />

string1 is equal to string2 0<br />

string1 is greater than string2 1<br />

string1 or string2 is Null Null<br />

Remarks Null is returned if string1 or string2 is Null.<br />

See Also String<br />

Example The following example uses the StrComp function to return the results of a string comparison. If<br />

the third argument is 1, a textual comparison is per<strong>for</strong>med; if the third argument is 0 or omitted, a<br />

binary comparison is per<strong>for</strong>med.<br />

Dim MyStr1, MyStr2, MyComp<br />

MyStr1 = "ABCD": MyStr2 = "abcd" ' Define variables.<br />

MyComp = StrComp(MyStr1, MyStr2, 1) ' Returns 0.<br />

MyComp = StrComp(MyStr1, MyStr2, 0) ' Returns -1.<br />

MyComp = StrComp(MyStr2, MyStr1) ' Returns 1.<br />

160 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!