Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split function without delimiter
#1
Solved: 11 Years, 4 Months ago
Hi Everyone,
I have a number of links in one string and I want to click on them 1 by 1. But the problem I am facing is that there is no delimiter in the string. No space, decimal or anything. Its just one long line of letters with no space in between.

The code I'm using is
Code:
str=Browser("").Page("").WebElement(Desc).GetROProperty("innertext")
msgbox str
MyArray = Split(str, "", -1, 1)
Msgbox MyArray (0)
(it just gives me the string without splitting it)

My question is how do I split the string with no delimiter.
Thanks in advance
Reply
#2
Solved: 11 Years, 4 Months ago
Can you post that string here?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 4 Months ago
The string is
"Library AssistantAudiovisual TechnicianReference LibrarianMedia Library SpecialistPhoto Library Assistant"
These are job titles in the form of link
Library Assistant
Audiovisual Technician
Reference Librarian
Media Library Specialist
Photo Library Assistant
Reply
#4
Solved: 11 Years, 4 Months ago
Hi Again,
Can someone help me with this problem. I need a code to split the above string in the form of the job title links.
Thanks in advance for the help.
Reply
#5
Solved: 11 Years, 4 Months ago
I see. Splitting may not be possible in this case. (unless you know the job titles beforehand which I am sure is not the case.)

You can get all the links using .childobject and then you can click on them one by one. (I guess this was the requirement in your OP)
Let me know if it works for you.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#6
Solved: 11 Years, 4 Months ago
If you are getting a string like that, then unless you know what text will be coming and in what order I don't think there is a way to split it programmatically. Possibly build a dictionary and compare bits of the string against the dictionary entries.

If you know what will be coming in the string you can use the VBS Left() and Right() functions to grab parts of the string and put them into other variables, but you will need to know the length of each string and the order that is appears in.

Best bet would be to have the DB query that returns the string throw some delimiters. Pass the work upstream! Wink
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Split function in string nidhishnair 13 64,505 07-07-2020, 03:47 PM
Last Post: helmzshelmz
Question Split Function Chaithra N 0 1,160 12-18-2019, 11:33 AM
Last Post: Chaithra N
  Split a string with multiple delimiters in VBScript nandha 2 8,564 02-10-2018, 06:44 PM
Last Post: nandha
  Calling a function in a Test Script from a function library anupam4j 3 6,113 06-26-2015, 12:31 AM
Last Post: babu123
  Split Function diya 2 5,743 11-28-2012, 08:49 PM
Last Post: diya

Forum Jump:


Users browsing this thread: 1 Guest(s)