Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to check if the string's format is alphabetical or numeric
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi QTPLearn,
thanks a lot, but what to do when:
Code:
str_Value = 123,231

in such cases this method doesn't work
I found a method which is good at the moment, but I am not sure if it will be good all the time(when the format of str_Value in the DB will be another and will be of a numbered format).
Code:
Dim MyCheck

MyCheck = varType(dBitem)
    If  MyCheck <> 8 Then
        ' formating the value of the string - max 2 nr.'s after the dot (e.g.: 123.09)
        dBitem = FormatNumber(dBitem, 2)
        Else
    End If

VarType Constants

These constants are only available when your project has an explicit reference to the appropriate type library containing these constant definitions. For VBScript, you must explicitly declare these constants in your code.

|Constant |Value| |Description|
vbEmpty |0 |Uninitialized (default)
vbNull |1 |Contains no valid data
vbInteger |2 |Integer subtype
vbLong |3 |Long subtype
vbSingle |4 |Single subtype
vbSingle |5 |Double subtype
vbCurrency |6 |Currency subtype
vbDate |7 |Date subtype
vbString |8 |String subtype
vbObject |9 |Object
vbError |10 |Error subtype
vbBoolean |11 |Boolean subtype
vbVariant |12 |Variant (used only for arrays of variants)
vbDataObject |13 |Data access object
vbDecimal |14 |Decimal subtype
vbByte |17 |Byte subtype
vbArray |8192 |Array

At the moment, my constants are of the vbDecimal type (nr. 14). But I am not sure that for all my tests/ queries this will be the only one type of constants.
Reply


Messages In This Thread
RE: how to check if the string's format is alphabetical or numeric - by lotos - 09-28-2010, 06:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to change 24 hrs time format to 12 hrs time format Varsha Gupta 1 2,830 04-21-2018, 11:06 AM
Last Post: Ankur
  How to validate a format of an alphanumeric string PrateepKaraval 2 5,995 11-08-2014, 10:26 AM
Last Post: vinod123
  Unable to read numeric values from WebTable into Datatable Akhila 2 4,715 11-26-2013, 03:43 PM
Last Post: Akhila
  Pdf to Excel or any other Format Conversion branjitk 1 2,474 06-14-2012, 08:14 AM
Last Post: basanth27
  How to extract numeric values hamzaz 3 3,868 04-26-2012, 03:15 PM
Last Post: ssvali

Forum Jump:


Users browsing this thread: 1 Guest(s)