Possible to get table cell strings with leading/trailing spaces?
See original GitHub issueThe OSRM route engine uses tables to define small ‘maps’ of node locations used in tests, ie:
| | | a | | |
| | | b | | |
| d | c | | g | h |
| | | e | | |
| | | f | | |
The horizontal and vertical position of nodes are translated to latitude and longitude. This might be a somewhat unusual use of tables, but it’s very useful.
To make the maps easier to read I would like simplify the syntax to:
| a |
| b |
| d c g h |
| e |
| f |
However cucumber strips leading (and trailing) spaces from the cell strings, ie. " a " is returned as “a”, which breaks the horizontal positions.
Is there any way to get the raw strings including the leading spaces?
I guess we could quote all lines, but this is awkward. I looked at transforms, but it seems cucumber js doesn’t implement it, and anyways I’m not sure it would solve the problem?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
sql - Look for trailing spaces in a table - Stack Overflow
Another way might be to append something on the string. declare @test table ...
Read more >How to remove leading and/or trailing spaces of a string in T ...
Use the TRIM function if you want to trim a string in a table. This function allows you to remove a specific character...
Read more >How to find values with Leading or Trailing Spaces in SQL ...
Solution: Let's create our test temp table with some test data. I have included leading and trailing space in 4 values.
Read more >How to find leading and trailing spaces in a varchar2 column
Answer: Finding leading spaces in a table column is easy with the substr function: select mycol from mytab where substr(mycol,1,1) = ' ';....
Read more >How to find values in a column has leading and trailing space
I have a table with ContractID column...which has n number of records.. i want to filter those columns which has leading and trailing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It appears that trimming of trailing and leading whitespace is done by gherkin and as far as I can tell there is no way to ask gherkin to preserve them. You could open an issue on gherkin if you would like.
I believe transforms are mostly for capture groups in regular expressions, though cucumber-ruby has data table transforms. That would start with the data gherkin parses though, so you would have already lost the leading and trailing spaces.
If all you want is the example you gave, you could try using doc strings.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.