Goldleaf | 🍂 Multipurpose homebrew tool for Nintendo Switch
kandi X-RAY | Goldleaf Summary
kandi X-RAY | Goldleaf Summary
Goldleaf is multipurpose homebrew tool for Nintendo Switch.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Goldleaf
Goldleaf Key Features
Goldleaf Examples and Code Snippets
Community Discussions
Trending Discussions on Goldleaf
QUESTION
I have a .csv file (generated from exporting a googleDoc spreadsheet) that I need to extract information from. The information does NOT contain a consistent delimiter.
I am currently using a comma (,) as a delimiter, which works fine when getting information from the first 4 columns.
However, when I want to extract information from column 8, I get incorrect data. This is because some cells contain 2 pieces of information split up by commas.
Cells with 2 pieces of information are given doublequotes (") at the start and end. Providing data like 1,"2,3",4
My splitter cannot recognise the difference between 1,2,3,4 and 1,"2,3",4 so the third value returns 3
for the first set and 3"
for the second set, when it should return 4
for the second set (3 for the first set is expected)
Below is an extract of the .csv file I'm using.
...ANSWER
Answered 2019-Nov-29 at 21:02First off, PowerShell has the built in ability to parse and manipulate CSV documents, so that would be a better option. But I will stick with batch processing.
Regular Expression solutionRegular expressions are no good to a pure native batch solution for two reasons:
- It is impossible to alter FOR /F behavior to parse tokens by regular expressions - it is what it is - very limited.
- To parse your file with FOR /F you would need to manipulate each line prior to parsing. Batch does not have any regex utility that can alter content. It only has FINDSTR which can do very crude regex searches, but it always returns the original matching line. On top of that, the FINDSTR regex is so crippled, I'm not sure you could properly parse a CSV anyway.
You could use custom JScript or VBScript via CSCRIPT to preprocess the file with a regular expression search and replace in such a way that FOR /F could then parse the file. I have already written a hybrid JScript/batch regular expression processing utility called JREPL.BAT that works well for this.
A quoted CSV field can contain quote literals, in which case the quote liberals are doubled. The following regex would match any CSV token (not including the comma delimiter) ("(?:""|[^"])*"|[^,"]*)
. It looks for a quote followed by any number of non-quote characters and/or doubled quotes, followed by a closing quote or any number of characters not including quote or comma. But your CSV does not contain any doubled quote literals, so the regex can be simplified to ("[^"]*"|[^,"]*)
.
CSCRIPT has no mechanism to pass quote literals within arguments, so JREPL has an /XSEQ option to enable extended escape sequence support, including \q
to represent "
. The other option is to use the standard \x22
sequence. JREPL "(\q[^\q]*\q|[^,\q]*)," "$1;" /XSEQ /F "test.csv"
will match any token (possibly empty) followed by a comma delimiter, and preserve the token and replace the comma with a semicolon.
But that still leaves empty tokens, and FOR /F does not properly parse empty tokens. So I can throw a bit of JSCRIPT into the replacement term to remove any existing quotes, and then surround each token with quotes (except for the last one, where it isn't needed)
JREPL "(\q[^\q]*\q|[^,\q]*)," "$txt='\q'+$1.replace(/'\q'/,'')+'\q;'" /JQ /XSEQ /F "test.csv"
Here is a demonstration showing how it could be used to parse your CSV:
QUESTION
I dont have any problems but i don't know how API call data Nested Values
My Web API have Controller, Models and DataAccess that i call by use sql to call data
I want API call JSON Data format similar as below :
...ANSWER
Answered 2019-Nov-15 at 07:03If you getting request JSON as:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Goldleaf
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page