Questions tagged [string-parsing]

The action of retrieving data from a string

String parsing is the action of extracting or modifying data pieces from a string. For example, one might parse a string to remove all quotation marks or to find all items inside quotation marks.

970 questions
8
votes
3 answers

Convert string representation of keycode to Qt::Key (or any int) and back

I would like to convert a string representing a key on the keyboard to a keycode enum like Qt::Key (or anything else). Example conversions would be: "Ctrl" to Qt::Key_Control "Up" to Qt::Key_Up "a" to Qt::Key_A "5" to Qt::Key_5 As you see the…
Alan Turing
  • 12,223
  • 16
  • 74
  • 116
7
votes
2 answers

Grabbing hidden inputs as a string (Using PHP Simple HTML DOM Parser)

So I have a form that has 4 inputs, 2 text, 2 hidden. I've grabbed the two text input values from the name, which are (get_me_two, get_me_three) and I've also grabbed the form action which is (get_me.php). What I'm looking to do now is grab the 2…
user676853
7
votes
3 answers

strip version from package name using Bash

I'm trying to strip the version out of a package name using only Bash. I have one solution but I don't think that's the best one available, so I'd like to know if there's a better way to do it. by better I mean cleaner, easier to understand. suppose…
cd1
  • 15,908
  • 12
  • 46
  • 47
7
votes
2 answers

Is there any Python implementation of logstash's grok functionality?

Logstash's grok is a string parsing tool which built on top of regex, it provides many patterns that make string parsing jobs so much easier, I just fell in love with it the first time I used it. But unfortunately, it's written in Ruby, makes it…
Reorx
  • 2,801
  • 2
  • 24
  • 29
6
votes
5 answers

Splitting on spaces, except between certain characters

I am parsing a file that has lines such as type("book") title("golden apples") pages(10-35 70 200-234) comments("good read") And I want to split this into separate fields. In my example, there are four fields: type, title, pages, and comments. The…
MxLDevs
  • 19,048
  • 36
  • 123
  • 194
6
votes
3 answers

Create BigInt with a String encoded to base 16

I am trying to parse a String like this: f2cff0a43553b2e07b6ae3264bc085a into a BigInt however when using the String constructor for BigInt I obviously get a Number format exception: BigInteger bi = new…
SnowyTracks
  • 1,965
  • 15
  • 21
6
votes
3 answers

Perl/regex to remove first 3 lines and last 3 lines of a string

I was looking to build a regex statement to always remove the first 3 lines of the string, and last 3 lines of the string (the middle part could be any n number of lines content). Any clean regex way to acheive this output? (i.e. always strip our…
simbatish
  • 123
  • 1
  • 1
  • 5
6
votes
2 answers

How to parse URLs in Google Apps Script?

I have a GAS project and I need to parse some URLs into their hostname and pathname properties as follows. Code.gs const url = new URL( 'http://www.example.com/cats', ); const { hostname, pathname, } = url; Here are some docs on the above URL…
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
6
votes
4 answers

C# - How to parse text file (space delimited numbers)?

Given a data file delimited by space, 10 10 10 10 222 331 2 3 3 4 45 4 2 2 4 How to read this file and load into an Array Thank you
q0987
  • 34,938
  • 69
  • 242
  • 387
6
votes
3 answers

Angular: HttpErrorResponse :"Http failure during parsing for..." - a String returning successfully from server

Spring-boot RESTful server side; a testing method that will return a string: @RequestMapping(value = "test", method = RequestMethod.GET) public ResponseEntity test(HttpServletRequest req, HttpServletResponse resp) { try { …
Maor Barazani
  • 680
  • 3
  • 12
  • 31
6
votes
1 answer

In F#, is it possible to have a tryParse function that infers the target type

Presently we do this... let parseDate defaultVal text = match DateTime.TryParse s with | true, d -> d | _ -> defaultVal Is it possible to do this... let d : DateTime = tryParse DateTime.MinValue "2015.05.01"
George
  • 2,451
  • 27
  • 37
6
votes
3 answers

No Member named stoi in namespace std

I am testing out std::stoi function found in the link below: http://en.cppreference.com/w/cpp/string/basic_string/stol but I got the error: No Member named stoi in namespace std. What should I do? Please advise thanks. P.S: I am using Xcode Ide to…
user2211678
  • 669
  • 8
  • 13
  • 24
6
votes
4 answers

Optimizing a word parser

Context: I have a code/text editor than I'm trying to optimize. Currently, the bottleneck of the program is the language parser than scans all the keywords (there is more than one, but they're written generally the same). On my computer, the the…
tay10r
  • 4,234
  • 2
  • 24
  • 44
6
votes
2 answers

Splitting Delimited String vs JSON Parsing Efficiency in JavaScript

I need to retrieve a large amount of data (coordinates plus an extra value) via AJAX. The format of the data is: -72.781;;6,-68.811;;8 Note two different delimiters are being used: ;; and ,. Shall I just return a delimited string and use…
Amar
  • 11,930
  • 5
  • 50
  • 73
6
votes
3 answers

Check if dictionary contains substring?

Say I have two dictionaries with the following key value pairs: 1, "Hello" 2, "Example" And another dictionary as follows: 1, "HelloWorld" 2, "Example2" I want to find out if these dictionaries contain the substring "hello" within them. …
john cs
  • 2,220
  • 5
  • 32
  • 50