Friday 2 August 2013

Explain cint, cdbl and clng in QTP.

In QTP scripting, many times you need to compare 2 values.
When you compare the values, it is necessary that both variables should have same data type.

Below functions are used to convert the data type of variable.

  1. cint  - converts the expression into integer sub data type 
  2. cdbl -  converts the expression into double sub data type 
  3. clng -  converts the expression into long sub data type 


Example -

str = "10"
print typename(str)

str = cint(str)
'Convert the string into integer data type
print typename(str)
----------------------------------------------------------------------
----------------------------------------------------------------------
str = "10.2"
print typename(str)

str = cdbl(str)
'Convert the string into double data type
print typename(str)

----------------------------------------------------------------------
----------------------------------------------------------------------
str = "108787"
print typename(str)

str = clng(str)
'Convert the string into long data type
print typename(str)

More examples on data type conversions are at date and string conversions 

Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.