Questions tagged [string-parsing]

The action of retrieving data from a string

string-parsing
Filter by
Sorted by
Tagged with
5 votes
2 answers
180 views

Custom parsing string

When parsing FTX (free text) string, I need to split it using + as a delimiter, but only when it's not preceded by escape character (say, ?). So this string nika ?+ marry = love+sandra ?+ alex = love ...
0 votes
0 answers
2k views

Python - ValueError: invalid literal for float()

I have a csv file that I'm trying to convert its data into Dense Design Matrix using Pylearn2 module. However what causes error is not related to pylearn2 but to my personal implementation. import ...
1 vote
2 answers
950 views

How to parse a sentence and get output of tags and words for a sentence?

I am using the below code to parse a sentence and get the output but it's showing an error (method apply in class LexicalizedParser cannot be applied to given types; required: List<? extends ...
2 votes
2 answers
83 views

How to extract variables from url query to readable format in java?

I have this url: http://myhost.com/Request?to=s%3A73746647+d%3Afalse+f%3A-1.0+x%3A-74.454383+y%3A40.843021+r%3A-1.0+cd%3A-1.0+fn%3A-1+tn%3A-1+bd%3Atrue+st%3ACampus%7EDr&returnGeometries=true&...
-3 votes
1 answer
1k views

read coordinates from a file in c [closed]

I have to read coordinates from a file in c in order to calculate the distance between two points. How to read the following input from a file? (25, 4) (1, -6) (2 ,3) (2,34)
2 votes
6 answers
2k views

Want to find and remove word only from string using - PHP

I hav especific need of removing word from string, But I am having problem when that word has dot (.) character. Lets see here is the string and what I have tried so far? $result = 'Hello Ka Kashish....
1 vote
1 answer
2k views

c# Custom Date class, string format

First, I would like to say that the use of this is only for learning, and probably won't be used in a functional application. I have created a class (named DateHandler) that receives a Date object (...
-2 votes
1 answer
302 views

Facing Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject

I am trying to develop a login app in which I am facing some problems. I looked for solutions to these at various places but couldnt find any. The errors are: Error parsing data org.json....
4 votes
3 answers
656 views

Python. Join specific lines on 1 line

Let's say I have this file: 1 17:02,111 Problem report related to router 2 17:05,223 Restarting the systems 3 18:02,444 Must erase hard disk now due to compromised data I want this output: 1 17:...
-1 votes
2 answers
483 views

Select contents of parenthesis in substring (VB.NET)

I have a substring of text like so: Serial Port Name (COM 1) How would I go about getting the contents of the above parenthesis? Thank you in advance.
0 votes
1 answer
51 views

how do i find all the positions of substring in a string c++ programming

I have string (c++ programming) that represent key press events: X, Y, DEL I have to print "X" if-and-only-if an event X was received, but no Y event preceded or succeeded it for two events. For ...
0 votes
2 answers
485 views

Splitting a string based on specific characters

I will try to describe my problem as well as I can. I am trying to write a program that will handle equations like: F = (X∨A) ↔ (X∨B) ( (X OR A) is equivalent to (X OR B) )! I have to solve it by 'X'...
0 votes
1 answer
346 views

Not able to parse continuos string using antlr (without spaces)

I have to parse the following query using antlr sys_nameLIKEvalue Here sys_name is a variable which has lower case and underscores. LIKE is a fixed key word. value is a variable which can contain ...
2 votes
4 answers
2k views

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 ...
6 votes
4 answers
1k views

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

Linux bash script removing part of string line by line

After greping output of command i have get below result: PAPU 0 1000 GPRS ATTACH SUCC GB 2400 2382 2333 (10) 1244 GPRS ATTACH FAIL GB 1216 ...
-2 votes
1 answer
541 views

Minecraft Color code parser [closed]

I am trying to make a minecraft color code parser. I take the original text from a textbox and display the resulting text in the rich textbox. The original text would look something like this: &...
0 votes
1 answer
84 views

string::std find method always find a character, even when it's not in the string

I'm doing a project for school where we are parsing through strings passed in from a text file. However, I'm having problems with string.find. When I run this code: string theFile; while (inFile) { ...
2 votes
1 answer
1k views

extract noun phrase "String" from a stanford constituency parse tree

How can I extract noun phrase String / Text without the POS tags from a constituency parse tree. I am able to extract noun phrases without parsing annotations but unable to find a way to extract just ...
0 votes
1 answer
483 views

C++ string parsing: how to detect the end of a message?

On an embedded system, I would like to parse data that arrives via serial interface (RS232). The data arrives one line at a time (lines are separated with \r characters and by some time) from a ...
2 votes
2 answers
137 views

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

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 ...
1 vote
2 answers
4k views

Converting a string to roman numerals in C++ [duplicate]

Possible Duplicate: How to convert integer value to Roman numeral string? first time asking a question here. I have a project on the horizon I've been working a bit on, and can't seem to find ...
0 votes
3 answers
93 views

c++, converting input string to number, failure to convert should not return zero [duplicate]

Hi im looking at the string conversion methods in c++ strtol, strtoll, strtoul, atol etc. It seems every single one of them will return a 0 (or 0.0) as a result for a string that was impossible to ...
2 votes
2 answers
2k views

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

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 ... ...
2 votes
2 answers
2k views

'indexOf' method performance optimization

According to Is JavaScript a pass-by-reference or pass-by-value language? JavaScript passes string objects by value. Because of that, calling the indexOf method will trigger copying the content. In ...
2 votes
2 answers
42 views

How can I parse this plaintext RP-style string into a more generic XML-style one?

I'm making an app that will translate roleplaying-style messages into something much more generic. The user has the ability to specify their preferences, like: Moves - /me <move> - *<move&...
24 votes
5 answers
26k views

In JavaScript / jQuery what is the best way to convert a number with a comma into an integer? [duplicate]

I want to convert the string "15,678" into a value 15678. Methods parseInt() and parseFloat() are both returning 15 for "15,678." Is there an easy way to do this?
1 vote
2 answers
87 views

Empty element inserted into ArrayList when reading from command line

I have code that i'm running to get a list of user groups from the command line of a given user, using the following code: private ArrayList<String> accessGroups = new ArrayList<String>();...
1 vote
1 answer
69 views

Does a program to convert "foo:blah" to JSON exist? [closed]

I would like to convert a human-readable list such as this: Enabled: No Server: localhost Port: 8888 Authenticated Proxy Enabled: 0 ... into an object, preferably sanitized as JSON, such as this: { ...
1 vote
2 answers
1k views

I am very confused on how to parse multiple delimiters using getline and strtok in c++

My code is posted below. I want to be able to parse using the delimiters " ()," and convert the strings into integers in cpp. while(getline(fin, line)) { x = atoi((strtok(line.c_str(),'(,)')); ...
1 vote
2 answers
73 views

parsing c commands: char*, char** confused

I read in c commands saved in char* (so basically a "string" of commands) byte by byte. For example, "echo a; echo b". Suppose I have char *wd = (char *)malloc(20);, and as I read a byte, store in ...
-1 votes
3 answers
101 views

Deleting img tag from string

I've got a string, $content, that contains: <p>Some random text <img class="alignnone" src="logo.png" alt="" width="1920" height="648"></p> Now I want to delete the image tag: <...
0 votes
2 answers
113 views

JSON string becomes different value when converting to float

I'm parsing some weather JSON from a local file. "temp_f":40.1, "temp_c":4.5, The problem is that when I parse it into an c value NSLog(@"%f", [weatherDict[@"temp_f"]floatValue]); //Logs: 40....
0 votes
1 answer
125 views

Search Strings in XML file using Stax

I'm using stsx to search for strings "t_val_calc_pwr_consumed" & "t_val_calc_enrg_accumulated" in the xsd section under "rules" tag of an xml file. When i try to search in the rules section of ...
1 vote
1 answer
145 views

javascript extract parts of a sentence

Hi I'm not that experienced in JavaScript, and I'm trying to parse commands given as full sentences. It has to be able to match the sentence to a function that will answer, and select sections that ...
0 votes
3 answers
274 views

Parsing product categories from string value

Updating the original question as I couldn't explain myself clearly and people focused on XML parsing instead of what I want - sorry I have a string array which contain strings formatted like this: ...
0 votes
1 answer
321 views

Search a particular string in XML file using Stax

I'm trying to check whether particular 2 strings are present in an XML file or not. The xml code <datapoint nature="PARAMETRIC" division="COLL_COMP_ENG" programmaticName="...
1 vote
3 answers
93 views

Splitting data from an array and pulling specific data

I think what i have to do is split and pull data to do the following: I have created a class, with the following array and method getContactList. I need to create a method getFirstNames() and return ...
-2 votes
2 answers
207 views

How to find the number of occurrence of all words in a string

The titles says it all, how do i find how many times a word comes out in a string. I have no idea what the user will input, so i cant test it by using case, can anyone help? Can i also extract only ...
3 votes
3 answers
1k views

Parsing a number from a string with thousands seperators

i'm parsing out Long values from given String-s. Long.valueOf() and Long.parseLong() wouldn't work - because such a String str is in the format 1,234,567 and can be surrounded by spaces. I can ...
2 votes
1 answer
309 views

Why does my program skip the first fgets()? [duplicate]

This is the choice: printf("\t1. Add new book record"); printf("\n"); printf("\t2. Edit book title"); printf("\n"); printf("\t3. View all the books"); printf("\n"); printf("\t4. View a specific book")...
0 votes
1 answer
133 views

How does this code work to extract URL's from a string with regex

I'm using a snippet i found on stackexchange that finds all url's in a string, using re.findall(). It works perfectly, however to further my knowledge I would like to know how exactly it works. The ...
-1 votes
1 answer
82 views

pass value from running thread

I'll start of with a brief description: I'm building a system to monitor the temperatures in a chemical reactor as a school project. We measure with an arduino that sends the data as a string to a pc. ...
0 votes
1 answer
1k views

Design Pattern for parsing serial strings

What design pattern do you suggest for the following case: A class is needed to represent the serial string of some documents which consists of numeric characters. There are 4 types of serials and ...
8 votes
1 answer
2k views

Can I use python 're' to parse complex human names?

So one of my major pain points is name comprehension and piecing together household names & titles. I have a 80% solution with a pretty massive regex I put together this morning that I probably ...
0 votes
1 answer
23 views

Parsing directories and detecting unexpected blanks

I'm trying to parse some directories and identifying folders witch do not have a specific correct pattern. Let's exemplify: Correct: Level1\\Level2\\Level3\\Level4_ID\\Date\\Hour\\file.txt Incorrect: ...
37 votes
2 answers
20k views

Get number of characters read by sscanf?

I'm parsing a string (a char*) and I'm using sscanf to parse numbers from the string into doubles, like so: // char* expression; double value = 0; sscanf(expression, "%lf", &value); This works ...
4 votes
2 answers
11k views

Documentum DQL: How can I get UTC time zone for Date columns to parse to .NET?

Documentum (DQL via DFC) always returns Date result columns as a string formatted like this: Wed Oct 19 16:01:59 PDT 2011 ...and the .NET DateTime.Parse function chokes on this — especially the PDT ...

1
10 11
12
13 14
20