184,959 questions
Advice
0
votes
6
replies
50
views
Searching for strings in multiple text files and outputting matched lines to a CSV
I have a folder full of hundreds of text files formatted like so:
holdrod =fl__2183_180325_0045
<bunch of data>
measburn_tot = 189.260915
<bunch of data>
I want to use ...
Tooling
0
votes
12
replies
98
views
Filtering an inconsistent string
I'm working on a project in which I need to filter out specific strings from an inconsistent API, where the strings are not always what I want. I need to filter out eligibility for different education ...
1
vote
1
answer
42
views
What explains the strange behavior of arguments in CMake macros (as opposed to functions)?
Here is a piece of cmake code:
macro(my_macro p)
message("--my_macro--")
message("p is: ${p}")
if(p) # <========================= (1)
message("\"if(...
-2
votes
1
answer
132
views
How can I parse ASCII byte input into integers for dates and readings in C? [closed]
I have a C function that receives data from an input source (e.g., a USB stick or sensor), where the input is ASCII characters representing numeric values. For example, I might receive:
"12/04/23&...
0
votes
1
answer
127
views
Segmentation fault when implementing a strcpy-like function in C [duplicate]
I am trying to implement a function in C similar to strcpy, but the program produces a segmentation fault when executed.
The code below attempts to copy a source string into a destination string, but ...
0
votes
3
answers
123
views
Core dumped after copying string to 2D array
I want to add strings to a fixed 2D array.
I have a core dumped error when executing my addToList function.
The program passes the list pointer and the string to add as arguments. I then iterate ...
-1
votes
2
answers
235
views
how many objects will be created with keyword new in java? [duplicate]
I just saw a video that explains basic concepts about string memory allocation (video: https://www.youtube.com/watch?v=gp6NY01XFoE). In 3:00, he says that two objects are created (one in String Pool ...
0
votes
2
answers
150
views
Why did Rust choose not to implement Add<char> for String, while providing String::push(char) instead?
Basic Add operation does not work
let mut st: String = "".to_string();
st += 'c';
|
3 | st += 'c';
| ^^^ expected `&str`, found `char`
Push Operation works
let mut st: ...
4
votes
1
answer
132
views
python -> YAML: the strings yes and no get quotation marks (but shouldn't)
Is there a reason why yaml adds single quotation marks around the words yes and no when I create a YAML file from a python dict?
MWE:
import yaml
def yes_or_no(
word: str,
) -> dict:
...
0
votes
0
answers
54
views
How to Parse CalDAV REPORT XML Response and Extract iCalendar Data in Gleam?
I am building a CalDAV/CardDAV client for the Gleam programming language. I have a function which sends a REPORT request to the CalDAV server (Baikal in this case) with this body:
let headers = [
#(&...
-2
votes
1
answer
174
views
How to write the \U unicode notation in Python regex? [closed]
I'm trying to use the \U format in Python 3 but found the following error:
>>> import re
>>> p = re.compile('[\U+0041\U+0042\U+0043]')
File "<stdin>", line 1
p =...
Best practices
0
votes
8
replies
78
views
Java CLI Task Tracker project
I am building a Task Tracker CLI project, currently working on the CLI structure to accept user input. I have used a switch statement to receive input from args. The problem I have is that I have ...
1
vote
1
answer
124
views
binary string code note working with condition
I have a binary string, in that binary string there are many zeros with followed by a single 1, for example, "...
1
vote
1
answer
144
views
R Code to recognize speaker turns in verbatim records with inconsistent formatting
I am trying to perform text analysis on large character strings that include multiple different speakers. I need to create a dataframe of 2 columns, speaker and turn, which have the person speaking ...
2
votes
1
answer
78
views
faster methods to remove substrings stored in one column from strings stored in another column
hist_df_2["time"] = hist_df_2.apply(lambda row : hist_df_2['timestamp'].replace(str(hist_df_2['date']), ''), axis=1)
I tried this to remove the date part from the timestamp. However, for ...