Open VB, create a new AXDLL, the project name is Str, the class name is count, and enter the following code:
The code copy is as follows:
PublicFunctionadd(ByValaAsDouble,ByValbAsDouble,ByValcAsInteger,ByValdAsInteger)AsDouble
d=CInt(d)
Ifc=1Then'add
add=FormatNumber(a+b,d)
ElseIfc=2Then' reduce
add=FormatNumber(ab,d)
ElseIfc=3Then'multiple
add=FormatNumber(a*b,d)
ElseIfc=4Then'
add=FormatNumber(a/b,d)
EndIf
EndFunction
Parameter description: a and b are the values to be calculated, c is the calculation type, and d is the decimal point how many digits are retained
Client ASP file code:
The code copy is as follows:
setobj=server.CreateObject("str.count")
dimc
c=obj.Add(455,45,4,2)
Response.Writec
The above code execution result is: divide 455 by 45, and the decimal point is accurate to the percentile