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

C++ parse sub-string to integer

I need a strtol function that would allow me specify bounds in which the string will be parsed. For example char * number = "123456789"; std::cout << my_strtol(number, 1, 3); Should print "234". Using some pointer arithmetic I could get pretty…
wondra
  • 3,271
  • 3
  • 29
  • 48
2
votes
4 answers

Remove whitespace from string excluding parts between pairs of " and ' C++

So essentially what I want to do is erase all the whitespace from an std::string object, however excluding parts within speech marks and quote marks (so basically strings), eg: Hello, World! I am a string Would result…
Joe
  • 346
  • 4
  • 15
2
votes
1 answer

Java Split String using regular expression

I have string that reads ParseGeoPoint[30.132531,31.312511]. How can I get the coordinates saved in double variables. i.e. I want to have double lat = 30.132531; and double lang = 31.312511; Here is what I have tried: String myText =…
A_Matar
  • 2,210
  • 3
  • 31
  • 53
2
votes
1 answer

Simple Python Temperature Converter

I'm fairly new to programming, and have decided to start with Python as my entry into it. Anyway, I can't seem to figure out why this temperature conversion script I wrote isn't running. def convert_to_fahrenheit(celsius): c = celsius f = c…
xponent
  • 151
  • 2
  • 2
  • 10
2
votes
1 answer

Best way to read lines in groups in a flat file

I have a file which consists of the groups of lines. Each group represents a event. The end of the group is denoted by "END". I can think of using a for loop to loop through the lines, store the intermediate lines and emit the group when "END" is…
defoo
  • 5,159
  • 11
  • 34
  • 39
2
votes
4 answers

Parsing JSON Feed

I have a json feed in a URL that contains following data. [{"ID":1123,"OrderNumber":"1394","ProjectType":"Postcard","Template":"WtlossStudy…
LSN
  • 328
  • 2
  • 14
2
votes
1 answer

Java getQueryString

So i'm trying to capture a certian section of a getQueryString(). I know I could try and go through and parse the string to get the certain section I wanted but was hoping to just be able to grab the piece I need. Here is my query…
littlevahn
  • 637
  • 2
  • 8
  • 25
2
votes
2 answers
2
votes
4 answers

progress 4gl OpenEdge parse key/value-pair string aka Query-String

I cant find anything on how i should parse a string of key/value paris AKA query-string like this one: FieldType="String"&FieldFormat="^[a-z0-9!#$%&'*+/=?^_`{|}~-]+$" field separators might be contained in the value like the above example this is…
Zesar
  • 566
  • 2
  • 14
2
votes
0 answers

How to display parsed json using linked array lists, custom handler, nested classes and onSuccess instead of onPostExecute method

I'm unable to convert parsed Json data to strings and display. I'm attempting to display the json in String format from within an inner class of the Main activity, which uses an arraylist as a name as-well as using a handler, the inner class of the…
dbo
  • 161
  • 1
  • 10
2
votes
2 answers

Extract trailing int from string containing other characters

I have a problem in regards of extracting signed int from string in c++. Assuming that i have a string of images1234, how can i extract the 1234 from the string without knowing the position of the last non numeric character in C++. FYI, i have try…
vincent911001
  • 523
  • 1
  • 6
  • 20
2
votes
1 answer

How to work with data from NBA.com?

I found Greg Reda's blog post about scraping HTML from nba.com: http://www.gregreda.com/2015/02/15/web-scraping-finding-the-api/ I tried to work with the code he wrote there: import requests import json url =…
Daniel Geffen
  • 1,777
  • 1
  • 11
  • 16
2
votes
2 answers

JSON.parse fails for negative floating point numbers

I have a simple script like this: request = $.ajax({ url: "/getmesomefloats.php", type: "post", }); request.done(function (response, textStatus, jqXHR){ // Log a message to the console …
2
votes
2 answers

opening and parsing a file in c++ to check for punctuation and to convert to lower case using two functions

I am trying to open a file and parse a file with separate functions. when i parse the file, i want to read each line in my input file and i want to ignore any punctuation and make everything lowercase so that i can then print it out to a separate…
lopezdp
  • 1,538
  • 3
  • 21
  • 38
2
votes
1 answer

How to perform lookaheads in a PEG without making the rule too greedy?

I'm writing a parser in Parslet. In the file I want to parse, I have the following structure: Item #1 denis calls 20 anna raises 60 denis calls 40 Item #2 another player raises 60 anna calls 60 ... To parse the actions, I did the following: As I…
Denis Lins
  • 816
  • 7
  • 22