How can I output tabs in the console? - vb.net

When I used to code in python there was a \t function when printing to leave a gap x amount of spaces until it reaches the next tab line, this was very useful for displaying tables in the console as all the bars would line up even when the data was of varying length. I've looked but can't seem to find a corresponding function in vb, wondering if anyone knew of one?

Thanks to #previousbetine and #Anu6is
Use VbTab and review this docs page regarding other ControlChars such as VbCrLf.
Thanks to #dbasnett for finding this docs page as well.

Related

Katalon WebUI.SetMaskedText() randomly wrapping text

I have a field in a popup to enter a phone number with masked text: "( _ _ _ ) _ _ _ - _ _ _ _".
(Masked text means that we are using jquery to automatically format the text being entered. You can learn more here.) The underscores above are just to represent the spaces for the digits of the phone number. :)
Results
The code randomly wraps the text when entering. I've tried using the string as '8015558245' and masked as '(801)555-8245', both wrap randomly with the results:
(015)558-2458
(155)582-4580
(555)824-5801
The only suggestion I found on my many searches of the internets was to double click the element first, which doesn't effect the results. Each time I run the test in incognito mode. Occassionally it works, the rest of the time it fails.
Code
Here is my code:
TestObject enterPhoneNumber = findTestObject('path/PhoneNumberObject')
WebUI.doubleClick(enterPhoneNumber)
WebUI.setMaskedText(enterPhoneNumber, '8015558245')
Specs
I am using Katalon v5.9.1, but it wasn't working on earlier versions either.
Chrome is the browser.
I think this might be happening because WebUI.doubleClick() is targeting the middle of the element so it starts typing somewhere behind the ().
Maybe try using WebUI.clickOffset(enterPhoneNumber,x,y) with a small value of x and y (5 px for example - calculated from the top left corner of the element) so you are sure click will land somewhere near the first (_ _ _ digit place.
Another option is using
WebUI.click(enterPhoneNumber)
WebUI.sendKeys(enterPhoneNumber, Keys.chord(Keys.HOME))
WebUI.setMaskedText(enterPhoneNumber, '8015558245')
with
import org.openqa.selenium.Keys
imported.
The answer was a combination of things:
First: I needed to set the cursor to the left of the masked text right at the opening parenthesis. To guarentee this, I used the suggested clickOffset(enterPhoneNumber, 40, 5). [Thanks #Matt Mrse for your suggestion!]
This didn't fix the text wrapping when using WebUI.setMaskedText(..), but it allowed for the next part to work reliably, and that is:
Second: Text entered into the box manually was always entered in correctly. So instead of WebUI.setMaskedText(..), I just sent the whole string as if it were typed by using WebUI.sendKeys(..).
The final code, that worked reliably (all other previous attempts failed within 1-2 attempts) after five test runs in five different tests is this:
WebUI.clickOffset(enterPhoneNumber, 40, 5)
WebUI.sendKeys(enterPhoneNumber, '8015558245')
WebUI.delay(1) //For humans to be able to see that text was entered correctly
That's it!
Hope this helps anyone else with this issue!
I think there are something you need to double check:
- are the () be added automatically when you typing the phone number?
- setMaskText() is used to enter text as '**************'
I am not sure if I understand the case clearly. Normally, I deal with this case by using sendKeys keyword, which will demostrate the typing action so the phone format can be added correctly.

Unwanted Linebreak in VBA-Variable

I'm pretty much a newbie to VBA and Access and I start to get kinda frustrated.
I'm working on a program for calculating prizes and therefor I got HTML-Datas with the necessary informations which get split up as following:
strHTML = GetHTML(HTML)
List() = Split(strHTML, Chr(10))
Just to make it clear, the HTML lines I pick up for this look as following:
Motortyp=SM132
Motortypreihe=SM
MotorBG=132
MotorFE=35
MotorZusatz1=B
MotorZusatz2=
ReglerTyp=Fremdregler
So far so good.
The whole gear description (e.g. "SM200.15C") is taken at once and somehow there still is kind of a line break afterwards which leads to me not being able to use it in queries as I want to.
It seems like the line break at which I split up the HTML somehow is still present and it just don't want to get replaced by stuff like Replace([Data], Chr(10). "").
Hope the question was Kind of understandable since I got a few brain lags today.
Thanks in advance,
Dennis
On Windows a newline is obtained from the combination of a carriage return Chr(13) and linefeed Chr(10) characters. Use
List() = Split(strHTML, vbCrLf)
where vbCrLf is a VB constant representing this pair of characters.

PDFBOX - WordUtils.wrap - need to display bold and non-bolded text on same line

I am a newbie to pdfbox AND java - trying to replicate a pdf letter with logos formatting etc. I need to use mixed font (bold) within a sentence. Presently appending paragraph string, using WordUtils.wrap, then begin.Text , etc. to parse and display (drawString has strikethrough cannot select this - I did find info for multi font using it). As field values will vary in text and length, I cannot simply search on, split and change font to display. Unable to use tags to do this (OMG I've tried everything I can think of!), but hoping there is a way to use a single char identifier for beginning of bold and another for end of bold??? One issue is that no guarantee the identifiers would end up on the same line of the paragraph. UGH. Everything else is perfect, EXCEPT the text I need to bold. Does anyone have any suggestions?? I am required to use pdfbox to accomplish this - cannot use Itext. Help please! Thank you!!
SOLVED - I figured it out. Thank you for your suggestions!
I did not want to use positioning, needing to keep it as simple as possible. We'll eventually need to implement hundreds of letters. I Am using Utils.wrap strictly as a line parser, not formatting, so that is cool.
Using 2 identifiers - 3 checks -
1) both on the same line,
2) beginning bold on one line, and
3) end bold on another line.
Using split string by " " and checks equal to identifiers. Formatting is perfect. Going forward may need to modify, if for some crazy reason identifiers are contained in letter text.
It works for the 1st roll-out. Thanks again - your help is much appreciated!!!

Find specific string then special character after string and integers

Ok this is a spin on a question I asked before, although i dont think I was clear enough in my explanation. My example strings are as follows.
06:15:34GET/a/users/23/list_messageHTTP
06:15:35PUT/a/users/231223/badge?HTTP
06:15:36POST/a/users/4454?set_action
I am trying to search for example "POST/a/users/" or "GET/a/users/" then find the next special character after the number/integers. So for the last example you can see there is ?, that is what im trying to locate to enable me to put a vbtab before it.
I can for instance find the 4th / in a line and put a vbtab before it but not find a string then find the next special character after it.
Any help is gratefully received, many thanks VBVirg

Fake space between First and Last Name in excel

I have a spreadsheet that I have imported from one of our sites that we use for User Access. I am having trouble in the formatting of the spreadsheet in order to make it searchable and to use VLOOKUP. In the Full Name column, the first and last name look like they are separated by a space " " but it does not work that way when I try to split them into First Name and Last Name columns. It is almost like it is a fake space. I have tried many ways to make it a true space between the words but nothing has worked and none of my researching to find a solution to this problem has been found. Can anyone help me with figuring this out so I don't have to continue to delete the "fake space" and add a real space between the words?
Any help is much appreciated.
These are non-breaking spaces. I am guessing that this data is coming from an HTML source.
You can get your formulas to work by changing " " to CHAR(160), which will return the non-breaking space (ASCII code 160).