📄 vbs79.htm
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML><HEAD><TITLE> Microsoft® Visual Basic® Scripting Edition </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="PRODUCT" CONTENT="Visual Basic Scripting Edition">
<META NAME="TECHNOLOGY" CONTENT="SCRIPTING">
<META NAME="CATEGORY" CONTENT="Language Reference">
<META NAME="Keywords" CONTENT="CLng function,Long data type,rounding,long integer,numbers converting,strings converting,numbers,strings"><META NAME="Description" CONTENT="CLng Function"></HEAD><BODY BGCOLOR=FFFFFF LINK=#0033CC>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR VALIGN=TOP><TD WIDTH=360>
<FONT SIZE=1 COLOR=#660033>Microsoft® Visual Basic® Scripting Edition</FONT><BR>
<FONT SIZE=5 COLOR=#660033><B>CLng Function</B></FONT>
</TD>
<TD ALIGN=RIGHT>
<FONT SIZE=2> <A HREF="vbstoc.htm">Language Reference</A> <BR>
<A HREF="vbs16.htm">Version 1</A> <P></FONT>
</TD></TR>
</TABLE>
<p><FONT SIZE=2>
<A HREF="vbs80.htm">See Also</A></FONT>
<HR NOSHADE SIZE=1>
<H5>Description</H5>
<BLOCKQUOTE>Returns an expression that has been converted to a <b>Variant</b> of subtype <b>Long</b>.</BLOCKQUOTE>
<H5>Syntax</H5>
<BLOCKQUOTE><b>CLng(</b><i>expression</i><b>)</b><P>
The <i>expression</i> argument is any valid expression.</BLOCKQUOTE>
<H5>Remarks</H5>
<BLOCKQUOTE>In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use <b>CInt</b> or <b>CLng</b> to force integer arithmetic in cases where currency, single-precision, or double-precision arithmetic normally would occur.<p>
Use the <b>CLng</b> function to provide internationally aware conversions from any other data type to a <b>Long</b> subtype. For example, different decimal separators are properly recognized depending on the <A HREF="vbs0.htm#defLocale">locale</A> setting of your system, as are different thousand separators.<P>
If <i>expression</i> lies outside the acceptable range for the <A HREF="vbs0.htm#defDataTypeRanges"><b>Long</b></A> subtype, an error occurs.
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=87%><TR><TD COLSPAN=2 VALIGN=BOTTOM><hr noshade size=1></TD></TR>
<TR><TD VALIGN=TOP><FONT SIZE=2><b>Note</b> <b>CLng</b> differs from the <b>Fix</b> and <b>Int</b> functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the <b>CLng</b> function always rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.</FONT></TD></TR>
<TR><TD COLSPAN=2 VALIGN=TOP><hr noshade size=1></TD></TR></TABLE></BLOCKQUOTE>
<hr noshade size=1>
<p align=center><em><a href="../../common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
</FONT></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -