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

Parsing a Connection String

Is there a standard library or code snippet to get a value with a connection string like this? string connstr = "DataServiceUrl=http://localhost/foo;" + "RemoteServerConnection={server=http://localhost/foo2;interface=0.0.0.0;};" + …
dave2118
  • 206
  • 6
  • 22
3
votes
1 answer

Is there a Perl module to convert c99 hex floating point notation to regular notation?

Is there a built-in library that I can use to convert c99 style floating point notation, example: 0x1.0p23f, to regular floating point numbers using Perl (and vice versa)?
madiyaan damha
3
votes
3 answers

Creating SQL Server JSON Parsing/Query UDF

First of all before I get into the question, I'll preface this with the fact that I know that this is a "bad" idea. But for business reasons it is something that I have to come up with a solution to, and I'm hoping that someone, somewhere might…
Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
3
votes
1 answer

In CMake, how do I check whether a string contains an integral number?

I have a string in CMake which I got somehow, in a variable MYVAR. I want to check whether that string is an integral number - possibly with whitespace. I have an ugly way to do it: string(REGEX MATCH "^[ \t\r\n]*[0-9]+[ \t\r\n]*$" MYVAR_PARSED…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
3
votes
2 answers

ruby start_with?(), end_with?()

I have a document with subject headers being enclosed in "|" characters. E.g. "| LINKS |" I want to check the string if it begins and ends with "|" character to verify that the particular document's subject header is valid. How do I do so…
thotheolh
  • 7,040
  • 7
  • 33
  • 49
3
votes
3 answers

How can I tell if a value in Request.Form is a number? (C#)

Suppose I must call a function with the following signature: doStuff(Int32?) I want to pass to doStuff a value that is read from Request.Form. However, if the value passed in is blank, missing, or not a number, I want doStuff to be passed a…
Vivian River
  • 31,198
  • 62
  • 198
  • 313
3
votes
4 answers

Algorithm for BASH/CSH/ZSH style brace expansion

If I have a string like a/{b,c,d}/e then I want to be able to produce this output: a/b/e a/c/e a/d/e You get the idea. I need to implement this in C. I have written a brute force kind of code which i capable of parsing a single pair of braces…
Abhinav Upadhyay
  • 2,477
  • 20
  • 32
3
votes
1 answer

parse float in java with trailing junk

Background: I'm trying to incrementally parse expressions like "cos(1.2)". Now, to the actual question (note: that the actual question is mostly in the next paragraph; the rest is ramblings about solutions that seem to almost work): Suppose I have…
Mark VY
  • 1,489
  • 16
  • 31
3
votes
3 answers

Eliminate punctuations and whitespace

I am new to c++ programming and would like to write a program which has the following requirement: Given a text consists of words letters numbers punctuations, and whitespaces. Filter out any characters that not in the range of 0..9, a..z or…
3
votes
0 answers

How to get specific fields data from string without field labels fetched from image by using tesseract-ocr

I have written a program that ask for the user to upload the DMV license picture and reads the DMV License details from the uploaded picture using tesseract ocr. I've got the tesseract part work which does well to some extent. I have got a raw…
root
  • 518
  • 4
  • 20
3
votes
3 answers

How can I convert an IEEE-754 binary representation String to a float or double in Java?

Since all Java floating-point numbers, which are floats and doubles, are internally represented as bits, I want to find an efficient algorithm to convert a String representing the bits of that float or double and convert it into its corresponding…
3
votes
3 answers

Extract WHERE components from MySQL string dynamically

Say I have the following string (forget that it is a MySQL statement): SELECT * FROM users WHERE name = 'fred bloggs' AND age=21 AND address='Mountain View, CA 94043' LIMIT 1 I need a way to extract the field name and value in the WHERE clause so I…
fire
  • 21,383
  • 17
  • 79
  • 114
3
votes
1 answer

Reading and Parsing a Strucutred Text File with Powershell

I'm trying to read the text files that are generated from another program and parse them to perform other actions. This topic is close but the file I'm reading has more "structuring" for lack of a better word. Here is a sample of what the file I am…
Eleron
  • 33
  • 6
3
votes
2 answers

Regular expression enforcing at least one in two groups

I have to parse a string using regular expressions in which at least one group in a set of two is required. I cannot figure out how to write this case. To illustrate the problem we can think parsing this case: String: aredhouse theball bluegreencar…
prl900
  • 4,029
  • 4
  • 33
  • 40
3
votes
2 answers

parsing nested structures in R

I have a json-like string that represents a nested structure. it is not a real json in that the names and values are not quoted. I want to parse it to a nested structure, e.g. list of lists. #example: x_string = "{a=1, b=2, c=[1,2,3],…
amit
  • 3,332
  • 6
  • 24
  • 32