Hi,
Could you please help me to parse a text of the element if the text has br element inside?
It is a timestamp. I need to analyze time without a date.
I did it by .substring, but I don’t like the idea to tie start index to the length of a string.
I need to know how to define indexOf(‘ ’)
If you do a search for “indexOf” for Java, you will likely find pattern or Matcher, but I would suggest using “split” which breaks up a String based on the RegEx character used.
Thank you for your answer.
I still have a problem with a timestamp because there is br element after comma that is the first after splitting. I need to remove this empty line to be able to calculate duration between two timestamps.
The question is open.
As a user of a low-code platform for automation I need a little bit more clarification from more experienced people to solve the problem.
Please RTFM and think about what you’re tryna do here…
You split() the String into date string, and time string, are interested in the time string but it has whitespace (i.e. newline) prefixing and postfixing it…
You need that part without the whitespace… What do you think trim() does? What part should that method be called on?
The code you posted is code – there’s nothing “low-code” about actual code.
Fact: There is no low-code solution to real-world coding problems (in automation or elsewhere).
It’s hard to respond to a person posting about issues with code that they later want to disown and claim ignorance due to adoption of dubious (and ill-defined) low-code automation solutions.
If you want to work with cope-paste patchwork code (seriously NOT a good idea), use StackOverflow.
Now, your problem.
.trim(), substring() and indexOf() (in JS) are all viable solutions. Which you use is entirely your choice. I would advise you read the voluminous amounts of information available to make your choice and figure out which is best for you.