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

Transform plain text file containing json object lines to json file

[techno: java spring boot] there is a file .txt containing : { "foo": "one" } { "bar": "two" } In java, is there a way to transform the content file in json like this ? : [ { "foo": "one" }, { "bar": "two" } ] Or get each line via a…
nico38
  • 29
  • 6
-1
votes
1 answer

Method for parsing a non-delimited text file showing well license data into lists?

I am currently trying to parse a text file in Python from the AER which shows the daily issued well licenses in Alberta. Basically I want to separate out the data for each license based on the type (well name, unique identifier, license number,…
KPubs
  • 1
  • 1
-1
votes
2 answers

Parsing C# string representing a 'fixed-length' message with fields of different sizes

I have a fixed length string message in a that looks like this: "\0\0\0j\0\0\0\vT3A1111 2999BOSH 2100021 399APV 2100022 " This message is created from me reading a byte[] into a…
cd491415
  • 823
  • 2
  • 14
  • 33
-1
votes
4 answers

How do I excecute a command for every split?

I am new to python, and am trying to filter a string that looks similar to this: "{Red,Plant,Eel}{Blue,Animal,Maple}{Yellow,Plant,Crab}" And so on for 100s of three word sets. I want to extract the second word from every set marked by "{ }", so in…
-1
votes
1 answer

Parsing (non-standard) json to array/object

I have string like this: ['key1':'value1', 2:'value2', 3:$var, 4:'with\' quotes', 5:'with, comma'] And I want to convert it to an array like this: $parsed = [ 'key1' => 'value1', 2 => 'value2', 3 => '$var', 4 =>…
tempoman
  • 13
  • 2
-1
votes
4 answers

convert a string into a dictionary

What is one of the pythonic ways to convert a string which has a built-in dictionary formatting into a dictionary? I have tried regex but it isn't quite there to be the right formatting . string_dictable…
Benyam
  • 61
  • 6
-1
votes
2 answers

Manipulating texts in arrays in javascript

I am working with a text like this one(a .cnf file): p cnf 5 5 c Thus, this file contains a problem with 5 variables and 5 clauses. c The following are the clauses for this file: 1 2 3 4 5 0 -1 -2 -3 -4 -5 0 1 -2 3 -4 5 0 5 0 -1 2 0 I need to…
-1
votes
2 answers

Workaround for this calculator parsing error

Context : I entered a expression 3.24 * 10^10 + 1 into a calculator that I made. My calculator's approach to solve this is - it first looks for pattern number_a^number_b, parses the 2 numbers into double using Double.parseDouble() method, then…
Sarthak123
  • 150
  • 6
-1
votes
1 answer

Python: parsing text of unknown length

I have a database full of strings such as: as.web.product.viewed(AT)2018-01-28T19:00:52.032Z(THEN)as.web.product.viewed(AT)2018-01-28T19:02:20.132Z (another possible delimiter is "(WITH)" and action is as.web.product.purchased so ideally I'd need a…
-1
votes
1 answer

SQL join using Haskell

I'm a newbie to haskell so some might find this question silly. I'm trying to make a SQL like interpreter using haskell's parsec library.I'm storing data in a Haskell map. To parse the query, the program is split into 2 parts parsing and the…
Lucy
  • 1,812
  • 15
  • 55
  • 93
-1
votes
2 answers

datetime format in ASP.NET C# not recognized

I have a column in my database with the following content: status 2018-12-31 15:31:56.000 (result of a select in SMSS) I am trying to get this column's data in ASP.NET code behind page through a query in C#: var connectionString =…
Just_Stacking
  • 395
  • 3
  • 13
-1
votes
1 answer

Python - Longest substring having only matched parentheses

For interactive parsing purposes, given an input string I need to extract the longest possible substring starting at index 0 and having only matched parentheses. Example (LISP-like s-expressions) Input string: (print "hello") (assign a (+ c d))…
-1
votes
2 answers

Convert Char to Double C++

UPDATE: I am passing a string variable and am iterating through the string character by character. Whenever I run into a decimal, I want to combine the previous position on the string (i.e. 2) and the next position in the string (i.e. 5) into a…
Alakd
  • 11
  • 2
-1
votes
2 answers

re.findall only finding half the patterns

I'm using re.findall to parse the year and month from a string, however it is only outputting patterns from half the string. Why is this? date_string = '2011-1-1_2012-1-3,2015-3-1_2015-3-3' find_year_and_month =…
-1
votes
7 answers

How to convert a string such as "12|34|56|78" to and output of 12, 34, 56, 78 in c++

i have to make a Convert constructor that takes a string. This string will hold the integers as a string of characters, numbers are separated by the character |. For example, if the parameter is the following string “12|34|56|78”, the resulting…
InvaderZim
  • 19
  • 4