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

How to Parse a String to Logical Condition in C#

I am looking for a nuget package which could help me to parse a string to a logical condition in C#. I have a configuration file in json, where users can configure the logic as follows. "condition": "(item1 AND item2) OR item3", This should be…
Harshani
  • 649
  • 2
  • 9
  • 22
-1
votes
1 answer

How i print specific information on Bash

#!/bin/bash echo "Digite o IP" read ip iod= snmpwalk -v2c -c public "$ip":161 .1.3.6.1.2.1.1.5 echo "$iod" OUTPUT iso.3.6.1.2.1.1.5.0 = STRING: "Name" I want just print the "name", I'm kinda new on bash scripting. I apreciate an hand. Thakyou.
LuizNFBR
  • 9
  • 3
-1
votes
1 answer

Calculate of prices in within an array of strings Array

I have an array that describes a list of auto parts (Swift/IOS,array already in such structure arrived from other source.): let parts = [ "Wheel = 230$", "Door = 200$", "Wheel = 300$", "Seat = 150$", "Seat = 150$", "Rugs =…
-1
votes
1 answer

How to remove javascript from string using python and then parse remaining string to table?

I have this string that i scraped from an unversity website. I want to parse it into a table where each row would consist of strings before and after a colon,":". This is the string. '課程中文名稱 Title of Course in Chinese:論文 課程英文名稱 Title of Course in…
pysolver33
  • 307
  • 1
  • 5
  • 13
-1
votes
1 answer

Typescript dynamic interface from object values

I am creating args parser from a string. I have interface for defining args names and default values interface IargsDef { name: string; default?: string; } What I want is for intellisense(make some dynamic interface idk) works with parse…
Ryner
  • 3
  • 2
-1
votes
1 answer

How to measure the length of a string before a specific character

I'm calling an API which gives me the sunrise time of specific cities I request. The issue is that when the sunrise is before 10 am I get it in the format, for example, '9:10 am'. This messes up my code and I need it in the format '09:10 am'. I'm…
pentaaax
  • 19
  • 1
  • 7
-1
votes
1 answer

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 5 8,1 9 5 1,1 7 6 1,1 8 6 1,1 1 6 9,1 1 7 8,1 9 7…
-1
votes
1 answer

How to convert String to int and call method on it?

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

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.querySelector('#cart_payment_params').innerText; let…
Steve Lloyd
  • 773
  • 2
  • 12
  • 33
-1
votes
1 answer

Finding coefficients of x in a string

I am trying to make an algebra solver, so I have to find the coefficients of x in an expression. Currently this is the code I have to take an input: equation = input("Enter equation: ") LHS, RHS = equation.split("=")[0],…
Sujal Motagi
  • 145
  • 8
-1
votes
1 answer

Unable to print specific nested json data with JSONSerialization

I'm making an api call to get some data, the json dataAsString looks like this... guard let dataAsString = String(data: data, encoding: .utf8)else {return} print(dataAsString) JSON DATA {"patch_report":{"name":"macOS…
Mdoyle1
  • 121
  • 1
  • 12
-1
votes
4 answers

Javascript regex parse complex url string

I need to parse a complex URL string to fetch specific values. From the following URL string: /api/rss/feeds?url=http://any-feed-url-a.com?filter=hot&format=rss&url=http://any-feed-url-b.com?filter=rising&format=rss I need to extract this result in…
Marco Martins
  • 117
  • 1
  • 8
-1
votes
1 answer

How to convert invalid JSON like string with inconsistent quotes into a valid JSON using regex in Java?

Here is a sample String. I am facing trouble particularly in the part 'rgba(71,13,226,0.47)' as the commas are present. The same regex should also parse a JSON array like string. varStr ="{ red : { orange: 100, dates: { …
-1
votes
2 answers

How to do simple math with a list of numbers from a file and print out the result in Rust?

use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::iter::Iterator; fn main() -> std::io::Result<()> { let file = File::open("input")?; // file is input let mut buf_reader = BufReader::new(file); let mut…
-1
votes
3 answers

Is there a way to normalize the phone number to 1-222-444-5555 (under North American standard)?

I am wondering if there is a way to normalize the phone number to the North American standard (1-222-333-4444) using regex pattern. The string will take either "-", whitespace, "(", ")", and numbers only. Thank you :) Updated: All possible input…
Kevin
  • 31
  • 1
  • 9