Thursday, 1 August 2013

Explain split function in QTP with example.

We can use split function to break the string using a delimiter.

For example -

Consider a string "pune*chennai*delhi*mumbai"

Now if you want to break the string you can do it using split function.

cities = "pune*chennai*delhi*mumbai"
arrayOfCities = split(cities,"*")

'Split function returns the sub strings in the form of array - (here arrayOfCities ).

For i=0 to ubound(arrayOfCities)

Print arrayOfCities(i)

next



The syntax of Split function is given below -

Split(Stringtosplit ,delimiter, occurence_Count, comparison_method)

In this function last 3 parameters are optional.

Default delimiter is space.
occurence_Count ->how many substrings should be returned in the array.

comparison_method -> This parameter will tell what kind of comparison should be used. i.e binary(case-sensitive) or textual (case-insensitive).

More interview questions and answers on strings in QTP

  1. What are the different string functions in QTP?
  2. How to extract the digits from given string in QTP?
  3. How to sort the array of strings in qtp
  4. How to get the first character in string in QTP?
  5. How to convert the string into upper case in QTP?
  6. How to get the last character from the string in QTP?
  7. How to replace the string in qtp?
  8. How to check if substring exists in QTP?
  9. Explain right, mid and left functions in qtp?
  10. How to remove the spaces from string in qtp?
  11. What are the trim functions in qtp?
  12. Explain replace function in qtp with example.
  13. Explain the split function in qtp with example.
  14. Explain lcase and ucase functions in qtp.
  15. What is the len function in qtp?
  16. Give the example of instr function in qtp
More interview questions and answers on arrays in QTP are given below.
  1. What is the difference between dictionary and array in QTP?
  2. How to create dynamic 2 dimensional array in QTP?
  3. How to sort array of strings in qtp?
  4. How to create array of dictionary in qtp?
  5. How to define or declare array in qtp?
  6. How to return array from function in qtp?
  7. How to find the length of array in qtp?
  8. How to find the size of array in qtp?
  9. Explain the ubound function in qtp.
  10. Explain the split function in qtp with example.
  11. What is dotnetfactory object in qtp?


Please give your inputs, suggestions, feedback to Us. 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.