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
2
votes
1 answer

Javascript - value exists, then disappears, then appears again?

This is driving me nuts. I can't work it out stepping through with Firebug either. Can someone please explain what is going on here? Basically I have an incoming text file where each line contains a pipe-delimited record. I'm splitting these into an…
nathanchere
  • 8,008
  • 15
  • 65
  • 86
2
votes
2 answers

What is the fastest way to remove all characters in a line up until a pattern match in c++?

I have very large files that need to be read into memory. These files must be in a human readable format, and so they are polluted with tab indenting until normal characters appear... For example the following text is preceded with 3 spaces (which…
Rick
  • 421
  • 3
  • 15
2
votes
2 answers

Finding lists of elements within a string using Pyparsing

I'm trying to solve the following problem using Pyparsing: I want to search a string for occurrences of three types of elements: lowercase words lowercase words following the literal string "OBJ" lists containing one of these elements, separated…
drkncls
  • 21
  • 2
2
votes
5 answers

line split array on console?

lets take for example i have a string declared: string master = "1.2.3.4"; which is in the form of: major.minor.project.build how do i get a string "major","minor","project" and "build" assigned separately from the string "master"? I know we have…
jeremychan
  • 4,309
  • 10
  • 42
  • 56
2
votes
1 answer

My job quote calculator is returning "X is not a function"

This is a corporate massage job quote calculator. From the user, we collect: Start time End time Number of clients needing a massage We then use those variables in conjunction with our business rules of time needed per person and hourly rate for a…
2
votes
0 answers

Python: how to parse a str to a char?

Python read a str '\\x0f' which is 4 chars('\\', 'x', '0' and 'f') but indeed I want to express it as one char which is '\x0f', is any way convert str '\\x0f' to char '\x0f'? Similarly, like converting '\\b' to '\b'.
stackKKK
  • 25
  • 1
  • 7
2
votes
1 answer

Swift Converting Format in Text File (String Parsing)

I was wondering what is the best way to take a text file containing lines in this format: Last_name:First_name:Number_of_cats:Number_of_dogs:Number_of_fish:Number_of_other_pets and produce a text file containing lines in this format: First_name…
M. Azam
  • 21
  • 4
2
votes
1 answer

Check to see if numbers in a column are sequential via command line

In a text file, I have a sequence of numbers in a column preceded by a short string. It is the 5th column in the example file here under "NAME": SESSION NAME: session SAMPLE RATE: 48000.000000 BIT DEPTH: 16-bit SESSION START TIMECODE:…
2
votes
2 answers

What is a performant way to split long lines when only a subset of fields is desired

The details of my query follow: I have a very large TSV (Tab Sep. Value) file (where large > 30 GB). I want to extract certain lines from this file that don't end with an empty last field. Since this is a TSV file, those lines that don't end with…
Michael Goldshteyn
  • 71,784
  • 24
  • 131
  • 181
2
votes
5 answers

How to fetch column names from 'MySQL Create Table' Query string?

I want to write a script in PHP which get 'MySQL Create Table' Query as string and store column names and their data types in array. For example: input string: CREATE TABLE `test` ( `col1` INT( 10 ) NOT NULL , `col2` VARCHAR( 50 ) NOT NULL…
Awan
  • 18,096
  • 36
  • 89
  • 131
2
votes
2 answers

How can I create a nested dictionary object from tree-like file-directory text-file?

I have a tree-structure separated by tabs and lines like this: a \t1 \t2 \t3 \t\tb \t\tc \t4 \t5 And I am looking to turn this into: { 'name': 'a', 'children': [ {'name': '1'}, {'name': '2'}, { 'name': '3' 'children': [ {'name':…
akad3b
  • 397
  • 1
  • 3
  • 13
2
votes
1 answer

DOM parsing, structured document traversal under the hood

As a developer, and I'm certain I'm far from alone here, I'm always curious to understand what's "under the hood". DOM parsers are one of the list-toppers of this curiosity for me. We all know the famous post. I have even hacked together a bit of an…
Dan Lugg
  • 20,192
  • 19
  • 110
  • 174
2
votes
3 answers

How do you get the first part of a URI in Angular 5?

I have a button on my navbar. When clicked, I want a different behavior depending on which URI the user is currently on. Let's say that I have this URI localhost:8080/entity/{entityId} How can I get entity, the first part of the URI, as a string in…
Wissam Goghrod
  • 327
  • 1
  • 5
  • 15
2
votes
2 answers

String parsing in JavaScript / jQuery

I have a string like url params. I want to get insurance value if insurance param comes only one time in string. For example: 1. Following string should produce result:…
Awan
  • 18,096
  • 36
  • 89
  • 131
2
votes
1 answer

How to handle substring with dynamic length in PowerShell

I have a list of domain as follows: facebook.com youtube.com/video google.com/ github.com/something/somewhere microsoft.com/default.aspx Now I want to use PowerShell to substring with expected result as follows, in order to create a cleaned…
EagleDev
  • 1,754
  • 2
  • 11
  • 31