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
0
votes
3 answers

How to call split(token) on a string that does not contain the token without causing an error?

I have two types of strings as the IDs of elements in my HTML markup: Dates: "april-23" "march-20" and season names: "springtime" "winter" The dates have a dash separating the month and the day. The seasons are a single word with no other…
0
votes
3 answers

Python file parsing -> IndexError

I am parsing through an ISI file with a few hundred records that all begin with a 'PT J' tag and end with an 'ER' tag. I am trying to pull the tagged info from each record within a nested loop but keep getting an IndexError. I know why I am…
MTP
  • 387
  • 1
  • 3
  • 8
0
votes
2 answers

Reading multiple records from a flat file in Java

I have a text file dump that I need to convert to a delimited file. The file contains a series of "records" (for lack of a better word) formatted like this: User: abc123 Date: 7/3/12 Subject: the foo is bar Project: 123456 Problem: foo bar in…
dwwilson66
  • 6,806
  • 27
  • 72
  • 117
0
votes
1 answer

Parse a string dynamically in ruby on rails

I have a hashmap with just two keys. One key, value is having a pattern like this - "flownamewkf1_somethingwkf2_something.." => 1" The second key, value has pattern like this - "some_name" => "group_name" Now i want to create a new string in…
user1455116
  • 2,034
  • 4
  • 24
  • 48
0
votes
1 answer

Parse multi-line string up until first line with certain character

I want to parse out all lines from a multi-line string up until the first line which contains an certain character- in this case an opening bracket. s = """Here are the lines of text that i want. The first line with and everything after…
Yarin
  • 173,523
  • 149
  • 402
  • 512
0
votes
2 answers

An easy way to parse a string to Key Value Pairs

Lets say I have class definition like this (fairly simple): class Person { public string Balance; public string Escrow; public string Acc; // .. and more } and I need to parse this string into the class above: BALANCE: 746.67 …
Tarik
  • 79,711
  • 83
  • 236
  • 349
0
votes
7 answers

Counting the number of occurences of characters in a string

I am trying to write a Java program which takes in as input a string and counts the number of occurrences of characters in a string and then prints a new string having the character followed by the no of occurrences. E.G. Input…
Chitransh Saurabh
  • 377
  • 6
  • 12
  • 23
0
votes
4 answers

How to replace the unit values with shell scripting

I have an output which is of the format weight:121p height:6f money:5 update:8 read:62b query:132 etc I want the output to be without the units like weight:121 height:6 money:5 update:8 read:62 query:132 etc I tried | tr "p", " " etc but the…
user244333
0
votes
2 answers

How to read integers from txt file by skipping =?

1 = 0 0 97 218 2 = 588 0 97 218 3 = 196 438 97 218 4 = 0 657 97 218 5 = 294 438 97 218 I have txt file like above.How can i read only integers from this file without = ?
droidmachine
  • 577
  • 2
  • 8
  • 24
0
votes
4 answers

C#: how to pass mathematical function from textbox to function

I have a textbox where i want to read user-input mathematical functions( ex: Math.Sqrt(x) etc). The code I've been using for console testing the function is static double f(double x) { double f; f = Math.Sqrt(x); …
user573382
  • 343
  • 3
  • 10
  • 22
0
votes
4 answers

How to extract column names from SQL Query as String SQL query is passed as a String

An SQL Query will be passed to my Method as a String, How can i retrieve the Column names in the query, if the query is e.g. Select name, dob, age, gender from table1; or Select uname AS name, hgt AS height, wgt AS weight from table1; I want to…
M.Hussaini
  • 135
  • 1
  • 5
  • 15
0
votes
2 answers

How to parse numbers data from EDID

I have a way of obtaining the EDID info of monitors with nVidia API, this gives me an array of 128 unsigned chars. When reading up on the edid data format on wikipedia however I noticed that the letters in the manufacturer id (bytes 8-9) are…
Bill Walton
  • 811
  • 1
  • 16
  • 31
0
votes
1 answer

Find Strict and Lose RegExp pattern

I have ^\s*(\w+(\,\w+)*\s*(:|,|\()(\(|\[)?\s*) Which works great in extracting "commands" from two set of strings like this **Strict pattern** command:some text command: some text command,command2: some text **Loose pattern** command :some…
Watt
  • 3,118
  • 14
  • 54
  • 85
-1
votes
1 answer

Good Address/String parsing libraries in java?

I am looking for any libraries in java that can parse an address out of a normal String of text. The text could contain all types of special and non-special :( characters but all I really want to pull out of the original string is a rough address…
El Duderino
  • 499
  • 2
  • 4
  • 15
-1
votes
1 answer

Similar parsing programs: why does one work, while the other does not?

This works: s_ids = array(); } public function AddS_id($s_id) { $this->s_id[] = $s_id; …
Wolfpack'08
  • 3,982
  • 11
  • 46
  • 78