dizou
November 13th, 2008, 01:01 PM
If it does not, how would I go about converting ints, doubles, longs, etc to a string? Thanks.
|
Click to See Complete Forum and Search --> : Does VBS have a to string method? dizou November 13th, 2008, 01:01 PM If it does not, how would I go about converting ints, doubles, longs, etc to a string? Thanks. PeejAvery November 14th, 2008, 07:28 AM Yes, VBScript has conversion methods for variable types. CBool() - Convert to Boolean Type CByte() - Convert to Byte Value CCur() - Convert to Currency Type CDate() - Convert to Date Value CDbl() - Convert to a Double Value CInt() - Convert to Integer Value CLng() - Convert to Long Integer Value CSng() - Convert to a Single Value CStr() - Convert to String Value dizou November 19th, 2008, 09:36 PM Ok thanks. What would happen if I used CDbl or CInt on a string without any numbers in it? PeejAvery November 19th, 2008, 10:33 PM It should return 0. HanneSThEGreaT November 22nd, 2008, 03:50 AM Ok thanks. What would happen if I used CDbl or CInt on a string without any numbers in it? IMHO, you could test whether or not a number is present first, before converting it. - Call me old fashioned, but to me, it just makes a bit more sense. dee-u November 22nd, 2008, 05:35 AM It should return 0. Shouldn't it be type mismatch? To be honest I don't do VBS but they should be similar to VB6.0 and the following code raises an error. Private Sub Command1_Click() MsgBox CInt("x") End Sub PeejAvery November 22nd, 2008, 08:24 AM Shouldn't it be type mismatch? Yes, it does. I was confusing it with an old basic language. dee-u November 22nd, 2008, 08:40 AM Yes, it does. I was confusing it with an old basic language. Thanks for the clarification, in my part and for the OP's sake also. :wave: codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |