Questions tagged [string-parsing]
The action of retrieving data from a string
941
questions
0
votes
1answer
15 views
How do i pass multiple parameters from list in sqlalchemy filter statement
the user returns a string where is parse to apply the filter in sqlalchemy.
but the numbers of parameters are unknown.
eg:
def fun_name(user_id, value):
return db.query(table)
.filter(or_(...
-1
votes
0answers
77 views
How to write a function that will work like 'backspace' and 'delete' in rust?
Here is our input:
let mut a = String::from("bpp--o+er+++sskroi-++lcw");
And here is our output:
"borrow"
I have a task:imagine that the - represents the backspace key and the + ...
-1
votes
1answer
21 views
Parse string into 2d integer array in javascript
I need to parse this string
d = "1 3 2 1,1 1 2 4,1 1 2 5,1 1 2 6,1 7 2 1,1 8 2 1,1 9 2 1,1 1 3 4,1 1 3 5,1 1 3 6,1 7 3 1,1 1 3 8,1 1 3 9,1 5 4 1,1 6 4 1,1 7 4 1,1 1 4 8,1 1 4 9,1 6 5 1,1 7 5 1,1 ...
-1
votes
1answer
21 views
How to convert String to int and call method on it? [duplicate]
I have tried to convert my String to an int but my code keeps crashing.
The code is as follows:
String age = getAge();
CalculateDaysSinceBirth((int) age);
But I get a NumberFormatException.
0
votes
4answers
47 views
Printing of initials without “.” as the last character
So I want to make a program in C which prints the initals of a name but facing one problem . My program should not print . as the last character, and I have tried this:
#include <stdio.h>
#...
0
votes
4answers
73 views
AWK FPAT not working as expected for string parsing
I have to parse a very large length string (from stdin). It is basically a .sql file. I have to get data from it. I am working to parse the data so that I can convert it into csv. For this, I am using ...
0
votes
2answers
23 views
How to get NumberFormatter::parse() to only parse actual numeric strings?
I’m trying to parse some strings in some messed-up CSV files (about 100,000 rows per file). Some columns have been squished together in some rows, and I’m trying to get them unsquished back into their ...
0
votes
2answers
43 views
How can I parse a variable into multiple columns according to multiple conditions in R?
I'm new to R, so please bear with me. I am looking at incarceration data, and have a variable conviction, which is a messy string that looks like this:
[1] "Ct. 1: Conspiracy to distribute" ...
1
vote
3answers
66 views
Regex to separate list of parameters at commas, but ignore commas enclosed in quotation marks
I need to parse a string that's a comma-separated lists of parameters of the form
key1=value1,key2=value2,key3=value3...
The complication is that the values can be enclosed in quotation marks to ...
0
votes
0answers
14 views
C# Using 2 listBoxes to select desired columns from CSV and display in dataGridView
The program I'm working on has 2 listBoxes, 2 dataGridViews, buttons to move selected items between the 2 listBoxes, and a textbox with buttons to select and load a CSV. Once the CSV is chosen ...
0
votes
1answer
53 views
C# make DateTime.TryParse() NOT assume year
The DateTime.TryParse() method in C# will assume current year if there's no year specified.
I want a function that will return false if the year is not specified (and not assume).
I cannot use ...
0
votes
1answer
38 views
strtok() - what am I doing wrong?
I have written a small program for testing purposes. I expect it to output the following:
Geeks
for
Geeks;var1=d;key=value
See the code:
#include "header.h"
int fill_cmd_list(char *orig, ...
0
votes
1answer
36 views
Return position if match is found
I'm working with some binary data which have similar matches throughout the code. For example "a6636f6f726473" is one of those matches. Now I want to do a reverse search for first match, the ...
2
votes
1answer
39 views
Is there a python standard function to parse a string into an argv list exactly like bash does, in Python?
Consider the following string:
./kmux.py -r 'messenger.* xx'
If kmux.py is a python script, and the string above was given to bash as an argument, then sys.argv will be the following list:
["./...
0
votes
1answer
40 views
Convert a string to a formula which should allow changing operator precedences [closed]
So let's say I have a string of a formula (for example string formula = "(2 + 3 * 3) + 7") but I want multiplcation operators to not have order priority over other operators. So in the ...
1
vote
3answers
71 views
Find Dot Separated Words in a String
I need to parse a log file to pick out strings that match the following case-insensitive pattern:
libname.data <--- Okay
libname.* <--- Not okay
For those with SAS experience, I'm trying ...
1
vote
2answers
25 views
Parse dataframe column for substring and return value
I have dataframe with a column called 'INFO' containing a string delimited by a semicolon like below. I would like to parse the string to return values corresponding to specific substrings and assign ...
0
votes
1answer
25 views
How to get a number in a line after a certain sequence of characters which can vary in number of delimeters?
I am reading input txt file line by line and trying to get a certain line and extract a number from it. The line can look like this:
"; Max: 144"
"; Max: 28292"
"; Max: ...
1
vote
1answer
19 views
error “Unsupported operation: removeLast” from List<String> generated by Uri.parse('').pathSegments
running the code below on dartpad currently Based on Flutter 1.23.0-18.1.pre Dart SDK 2.10.4
import 'package:flutter/material.dart';
void main() {
final _list = ['1', '2', '3', '4'];
print('_list ...
1
vote
2answers
47 views
How to extract an image URL from a div?
I want to extract the background image url from a div with PHP. I want to search the class in the string and extract the background-image url.
For example:
<div class="single-post-image" ...
1
vote
1answer
55 views
Why does my line from BufReader::lines not match?
I am trying to parse a text file and find if a string is equal to current line I am on using BufReader:
let mut chapter = String::from("Chapter 1\n");
//open file
let file = File::open(&...
-1
votes
1answer
18 views
java get/skip all commented lines in python file
How would I programmatically parse a python file and get all the commented-out lines that are in triple quotes ''' and normally commented lines # so I can skip them to speed up parsing time?
-4
votes
1answer
37 views
How can I pick a specific random string up from an arrayString? [closed]
I have a situation where I received an input string with a random value contained there ("54403dd5-5f1d-4ba0-8477-9b16807ee285") basically that string is received from another source code ...
0
votes
3answers
34 views
How to split a string between all chars and int in Python
For example I want to convert "2pL11H10K" into [2, p, L, 11, H, 10, K]
0
votes
1answer
39 views
Powershell convertfrom-string automatically parses decimal to dates. How do I prevent this?
Im trying to convert data from cli to powershell object using ConvertFrom-String, however when I do that decimal numbers are automatically parsed as dates (As seen in column P4 below). How do I ...
0
votes
1answer
98 views
Parsing Request, PHP/Laravel
This API is used by an access control device to report personnel pass-through records, After me (A third-party platform) called the API to a face recognition terminal or face recognition access ...
0
votes
0answers
16 views
Unexpected string in JSON
I'm trying to render some text to html in different languages. But JSON doesn't recognize all of them. Please advise me..
<span
class="intro__text__welcome txt-type"
...
1
vote
2answers
30 views
How do I parse data without using the index because some characters are different lengths
I need to parse this data so that each value in the data parsing column is deposited in its own column.
userid data_to_parse
0 54f3ad9a29ada "value":"N;U;A7;W"}]
1 ...
1
vote
1answer
23 views
Capture variable-length group that is zero-padded in a fixed-length string
I use regex to validate strings in a set and extract several pieces of data from each valid string. I want to improve the extraction to, in effect, trim the zero padding from capture group 1.
Valid ...
2
votes
2answers
45 views
Regex match - Python - any amount of characters
Cannot find an example that looks like what I am looking for.
I am trying to capture ASN numbers in an FAA Aeronautical NOTAM. Example Below:
Example Text:
2019-AWP-7268-OE
Regex Match (findall):
\d{...
0
votes
0answers
62 views
Pass CSV data to webservice input in SAP MII Transaction
I have a requirement where to a certain SAP MII transaction, I shall get input in the following format
1234,3456,5436/ABCD,EFGH,IJKL,/1111,2222,3333
Every '/' denotes end of the row and the column ...
0
votes
3answers
37 views
Javascript Trying to parse string into an array [duplicate]
I am having a variable which stores a string like this
var colorArr="['#3f67c5', '#cb4728', '#f19d39', '#459331', '#984830', '#8C2094']"
I am trying to convert this string into an array by
...
1
vote
3answers
96 views
Given a string a numbers, format as 3 digits per chunk [duplicate]
I need to create a method that takes in a string of numbers - for example, 174709580098747434.
It then needs to be formatted as chunks of three and returned in an array - for example, {174, 709, 580, ...
0
votes
0answers
57 views
I am parsing user input as an “int”, but how do I handle invalid inputs? [duplicate]
I'm trying to make an If-else statement to parse input as "int", but I also want to resolve the exceptions. What if the input is a string? How can I make my computer reading different values ...
1
vote
2answers
59 views
Remove duplicated characters using regex
How would you remove duplicated characters in regex while some characters are meant to be repeated?
For example, I have "BBAALLLLOOOONN" and I want the output to just be BALLOON.
I have ...
0
votes
1answer
18 views
Univocity - Parsing a fixedwidth flat file with one row - performance impact with 300 parallel threads
We have a project that deals with millions of transactions everyday which has some tight SLAs. As part of parsing the flat file that comes as input to a bean , we used beanio which was working better ...
0
votes
1answer
55 views
Why does my code fail to pass the test of removing spaces from string in Javascript?
Hi everyone! I'm new to coding and I'm failing to pass this test. I need to write my code in order for this string:
'<h2> Lost In Space</h2>'
to be changed to this string (...
-1
votes
1answer
34 views
How do I parse a JSON string that defines a function
I have the following string as content in a div. I want to use JSON.parse to convert this into a JSON object. When I try it always fails with Unexpeded token.
let paramstr=document....
0
votes
3answers
48 views
String to DateTime, TryParse was not enough
Here's a method that works:
/// <summary>
/// Checks date validity.
/// </summary>
/// <param name="candidate">String to check</param>
...
0
votes
2answers
66 views
parse array in string form in javascript
I am trying to process a json document from 3rd party api. the data return is in a string format and lokks something like this:
{
"response":{
"field1":7,
"field2":0,
"records":[
...
0
votes
1answer
44 views
how to parse commit message into variables using bash?
I using bash and I have string (a commit message)
:sparkles: feat(xxx): this is a commit
and I want to divide it into variables sections:
emoji=:sparkles:
type=feat
scope=xxx
message=this is a ...
0
votes
3answers
559 views
How to parse URLs in Google Apps Script?
I have a GAS project and I need to parse some URLs into their hostname and pathname properties as follows.
Code.gs
const url = new URL( 'http://www.example.com/cats', );
const { hostname, pathname, ...
1
vote
2answers
64 views
Converting a string date to useful date
I'm pretty new to programming and I'm working with a database that has a date field. All the data in the field are saved as strings on the yyyymmdd format. I want to convert those to something ...
1
vote
1answer
180 views
Find Time Between Two Dates JSON [duplicate]
I'm using the khanacademy.org API scratchpads to get the JSON data for users. I am trying to calculate how long they have been a member of khan academy using the date joined and the current date.
...
-2
votes
1answer
38 views
The compiler does not accept my JSON notation
"Uncaught SyntaxError: Unexpected token c in JSON at position 2" This is what my compiler says. In JSON I wrote:
{ chGamma:7.5, chTheta:7.5, dgamma:0.01, distance:10.5,
dtheta:0.03, freq:1, gamma:...
0
votes
1answer
35 views
Parsing a text from one column to three columns in SQL Server Select Query
I have a table from where i need to parse a column which have a sentence(i.e Q and A about issues), I want to parse that one column into 3 Columns, Please see the below example.
Thanks in advance :-)...
0
votes
0answers
106 views
Change Asterisks to Bullet Points
I have a long document that has nested bullet points using asterisks and tabs. I'm trying to see if there's a way to quickly iterate through line by line and determine the number of tabs before the ...
4
votes
1answer
85 views
Using TO_NUMBER to parse numbers both in fixed notation and scientific notation
Using Oracle SQL, how can I convert string to a number when the string (a VARCHAR2 column) can contain either:
a number in fixed notation, such as -11.496606820938826
SELECT TO_NUMBER('-11....
1
vote
2answers
43 views
Parse single qouted dictionary key and value in Python
I have a Python dictionary
original_dict={'body': '{"infra":["dev4","elk"],{"type":"file_integrity"}'}
I want to be able to parse original_dict keys and values as a normal dictionary which I am not ...
2
votes
2answers
80 views
What is the fastest way to remove all characters in a line up until a pattern match in c++?
I have very large files that need to be read into memory. These files must be in a human readable format, and so they are polluted with tab indenting until normal characters appear... For example the ...