9,739 questions
-1
votes
3
answers
164
views
Populate an array with strings of words where each element is one word less than the previous
When I run the following code, I'm receiving this output:
PHP
PHP What
PHP What is
PHP What is PHP
However I want to receive the following output:
PHP What is PHP
PHP What is
PHP What
PHP
What thing ...
-4
votes
1
answer
119
views
how to trim, substring and make capital letters in a column [closed]
I have a table in oracle apex:
CREATE TABLE Fundusze (
Id NUMBER(10) NOT NULL,
Nazwa VARCHAR2(50) NOT NULL,
Waluta VARCHAR2(50) NOT NULL,
Typ VARCHAR2(50) NOT NULL,
CONSTRAINT ...
1
vote
1
answer
73
views
substring(enumColumn::TEXT from 'pattern') not IMMUTABLE in PostgreSQL
As I understand it, the substring function should be immutable. However, when I try to generate a column from the expression substring(enumColumn::TEXT from '-(.+)') I get a generation expression is ...
2
votes
1
answer
190
views
How to compare a reference combination to multiple cells and return the closest match header in Excel? [duplicate]
I'm working on an Excel sheet where I have:
A reference combination in cell S4, like 4,D,D,D,D,D,D,D
A range of combinations in W3:AH6, where each cell contains a comma-separated string like 3,A,A,A,...
1
vote
2
answers
137
views
String pattern to extract street number and name
I have a data frame with a column of street addresses, some of which include suite, apartment, floor, etc., which are not useful in retrieving the latitude and longitude of the address.
I have ...
15
votes
7
answers
1k
views
Split all columns in half by character position
My dataframe has a bunch of columns, each with six characters. Like this:
df = data.frame("A" = c("001000","101010","131313"),"B" = c("121212&...
0
votes
3
answers
142
views
Line 17: Char 20: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' [solution.c] [closed]
bool isSubsequence(char* s, char* t) {
int len = 0;
bool res = false;
int k = 0;
len = strlen(t);
char str[len+1];
uint64_t z;
for (uint64_t i = 0; i < pow(2, len)...
-2
votes
3
answers
159
views
Remove substring from string that consists of same words but different separators between them
In my Java program I have the two strings x and y.
String y is a substring of x. It contains the same words in the same order as x, but the words are separated in different ways.
String x contains &...
-1
votes
2
answers
107
views
SQL string numeric value range comparison
I have a string like A18.30 and I want to compare if this falls under these 2 min and max values: A17.0 and A19.0.
A18.30 => A17.0 between A19.0 [correct]
P1A.5 => P1.0 between A2.0 [In-...
0
votes
2
answers
92
views
Oracle SQL. how to trim a leading substring
I wish to remove a leading substring from a string. I tried to use LTRIM function, but it returned a bad result. In detail
SELECT LTRIM(' AND DAT_MOD = ...', ' AND ') FROM DUAL;
returned
T_MOD = ...
...
2
votes
2
answers
176
views
How to check if a string contains a substring in batch
There was a question asked here with the same title, but I don't understand what it was talking about.
All I'm trying to do is see if the end-user is putting in vaguelly the same text. This will also ...
-4
votes
1
answer
118
views
Python - Iterate once over string to find all substrings and their positions
I have the following python code using regex that finds the substrings "¬[", "[", "¬(", "(", ")", "]" and get their positions
(I transformed ...
0
votes
1
answer
31
views
How to limit string-length in a logged message?
Consider the logging call below:
logger.debug("Neither {} nor {} in {}",
pattern1, pattern2,
sql.substring(0, idx));
The intent is to cite only ...
1
vote
1
answer
53
views
Is there a fast way to match a column of strings to each substring in a list?
I have a dataframe column which is comprised of strings. I also have a list of substrings. For every substring, I want to test it against each string in the dataframe column, returning True if the ...
0
votes
4
answers
112
views
To return text value between the first and second semicolons counting from the right of a string
I have a field in a table which consist of a string of values separated by semi-colons, e.g. apple; banana; orange; pear
I have been trying to build a SELECT statement to return the second group in ...
1
vote
1
answer
63
views
Algorithm to find the best file match when the filename is often a substring of the search term
I'm making Chrome extension to find lyrics for song on YouTube. I have lyrics written in files in extension folder. Files are named Name of song.txt. What I'm trying to do is to match search term ...
0
votes
3
answers
104
views
Parse TEXT datatype column to grab values based on TAGS
I have the following string stored in a TEXT datatype which I want to extract the values for
Date:
Queue:
File Name:
and return them in their own columns.
STRING:
If you are able to, please ...
2
votes
3
answers
78
views
What are some possible solutions to identify the next non-existing value?
I'm currently working on a scenario where I need to find the next available ID within a list of unique IDs that contain both letters and numbers.
While I have a working solution, I'm interested in ...
5
votes
2
answers
419
views
A more efficient way to check which substrings are present in several test strings?
I would like to write an R function that takes a string as input, checks if several thousand substrings are present in that string, and returns a vector of substrings found in the tested string.
I ...
2
votes
3
answers
137
views
Split a string based on multiple variable substring
I am trying to clean some data in SQL Server (v15.0.18384.0) but cannot figure out how to split a string with a variable substring.
I have a column with multiple rows of single long strings. Each row ...
0
votes
2
answers
88
views
Matching contents of a cell to comma-separated values in another cell
I have a category list as shown below; PAYEE contains comma-separated values for each cell value in EXPENSE CATEGORIES:
How can I use VLOOKUP or XLOOKUP to match the values in Merchant Name to PAYEE ...
0
votes
2
answers
88
views
Check if string contains a substring representing date and hour in various formats
I have a bunch of pictures in a folder, pictures whose names contain a substring which represent a date(time) like "YYYY-MM-DD-HH-MM-SS", "YYYYMMDD" or "YYYYMMDD_HHMMSS" ...
1
vote
4
answers
124
views
regex (preferably sed) to replace any occurrence of a certain char within a specific pattern match [duplicate]
In a random string how do you replace every % with ^% except when it is part of a quote?
e.g.
r%"%a"%n"%d%"o%"%%m to become
r^%"%a"^%n"%d%"o^%"^%^%m
...
0
votes
1
answer
152
views
In Rust can I filter lines of a String that contain codes like "1.2.3" OR "1.2.3.4"?
I am building a program to help count the number of distinct codes that occur in multiple PDFs. I have got the data from the PDFs, that's not a problem. I just need to filter the lines based on ...
0
votes
0
answers
126
views
SubString and IndexOf giving a puzzling result
This is the code to meant to pull the value from in front of a variable (in this case the variable is Net Total )
vIndexStart = vOutput.IndexOf(vNet) + vNet.Length
If vIndexStart < 0 Then
...
1
vote
1
answer
61
views
Print supersequence
I'm struggling with understanding a concept of minimum supersequence of two given strings.
I understand how to print this supersequence from 2D dp table that we get after solving LCS problem for two ...
0
votes
1
answer
99
views
formating text to a new field in foundry contour
I need to transform text from one field to a new one. Currently the TEXTVALUE is "202411219999".
The NEWVALUE to obtain must be like this: "2024-11-21"
I managed to use substring(&...
-3
votes
4
answers
129
views
I am trying to get the start date ONLY from the column below using a SUBSTRING. Can someone tell me what I'm doing wrong?
This is what I have so far:
DECLARE @STR AS VARCHAR(1000) = 'CustomerID #101010 added. Fixed Price: 3.5555 Effective from 10/16/2024 to 03/31/2 SADFGZFGDA025 Deliveries: 100 Company Pricing Program: ...
1
vote
4
answers
124
views
Python function to remove strings from a list if a substring already exists
I'm wondering if they're is a "pythonic" way of removing elements from a list, if that element contains a substring of another element.
For example say we have a list like this:
["/var/...
0
votes
1
answer
196
views
ClickHouse data skipping index seemingly not skipping any rows
I have a simple table in ClickHouse with 10M rows, defined like this:
CREATE TABLE data.syslogs
(
`id` UInt32,
`time` DateTime,
`priority` UInt8,
`message` String,
INDEX ...
1
vote
3
answers
203
views
How to check if a string contains one of a few key words in C
I'm pretty new to C but I'm experienced in python,
I'm trying to check whether an input string contains a certain word in it
for a example a mood checker
char str[20];
printf("How are you ...
0
votes
1
answer
58
views
Which regex can I use to find exactly two sub-strings in a longer string?
I am completely new to RegEx and I am struggling even with a simple case.
I would like to identify the following cases, for example:
IR!GBP!INDEX.GBP
IR!GBP!INDEX.USD
where the sub-string GBP (or USD) ...
1
vote
0
answers
188
views
Swift Regex Error: Cannot Convert 'Regex<(Substring, Substring, Substring)>' to 'Regex<AnyRegexOutput>' When Matching Patterns
I'm working on a Swift class that utilizes regex for pattern matching, but I'm encountering an error when trying to initialize the Regex type in my custom class.
class code:
import Foundation
class ...
2
votes
4
answers
174
views
How to make Substring keys with String.Index for count all occurrences of all size 2 substrings
I'm not familiar with String.Index, is there a better way to make the substring keys than this:
let a = "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA"
let keysize = 2
let ...
0
votes
3
answers
106
views
VBA remove string custom salutation name from list table excel
I have string name with salutation
DATIN SERI PADUKA JOHN DOE with actual name is JOHN DOE
and i have list excel for salutation :
DATIN SERI
DATIN SERI PADUKA
Currently using substitute function from ...
0
votes
1
answer
35
views
using a substring of a variable name in an SPSS macro
I want to rename a list of variables in a dataset that has thousands of variables. There are certain patterns in the renaming process and I tried to write a macro for this.
I want to drop the last ...
0
votes
1
answer
74
views
How to use my substring column to join a subquery to the parent query
I have a table which contains a data field of assorted IDs written in plain text.
Other_ID
Data
Date
123
user_id:098; metdata:[ID: 6482]
2024-10-13
456
user_id:754; metdata:[ID: 0743]
2024-10-12
123
...
0
votes
3
answers
173
views
Print substring of column based on position filter in awk
I have a file with following 3 columns
1 a1 abcd
2 b1 acdb
3 c1 abcd
I need to extract/print rows based on substring of column3 on position filter (2=="b"), so the output should ...
1
vote
1
answer
50
views
How search and locate (row and column of) substring in entire df?
I have a large df with 70+ columns and 1 milions+ rows, I would like to find and locate the a substring
I tried
df.apply(lambda row: row.astype(str).str.contains('substring').any(), axis=1)
I now only ...
-4
votes
1
answer
82
views
Find sub string between two capital words in a text [closed]
I would like to get substring between two capitalized words from the string "THIS is the first line in this PARAGRAPH"
I would like the output for this to be "is the first line in this&...
4
votes
2
answers
127
views
How to extract a substring from an EDL line, between 2 sequences of characters
With Powershell, I want to extract from a video markers EDL file (Edit Decision List), the content related the Marker name.
Here an example of an EDL line
|C:ResolveColorBlue |M:The Importance of ...
0
votes
2
answers
106
views
Substring between 2 strings in Oracle SQL [duplicate]
I need the capture the text between Detl Code Desc: and Ftyp Code Desc:
see the example below:
Detl Code Desc: CPS Leadership PD Ftyp Code Desc: Flat Fee
Detl Code Desc: CPS Professional Develop. ...
0
votes
2
answers
138
views
Partition a string into substrings that all have majority characters
I'm trying to solve this problem:
A string has a majority character if the majority of the positions in the string are the same character. For example, ababa has the majority character a (three of ...
0
votes
2
answers
142
views
Have to add magic number to length in .Substring
I have a data structure that I read over UDP, and it looks like this:
$T_DATA,17,<?xml version="1.0"?>
<TData id="Channel 4">
<Meta>
<InstrumentID>17&...
0
votes
1
answer
55
views
SQL Server (2014) How to extract one or two possible values fromS SRS Catalog table
SQL Server 2014, ReportServer 2008 db, Catalog table, Parameter column returns the following string:
<Parameters>
<UserProfileState>0</UserProfileState>
<Parameter>
<...
-1
votes
2
answers
105
views
Need part of a string in column
I have values such as below in a column of a table in SQL Server 2022.
What I need is to grab with a select statement the value between <artikel> and </artikel>
Tabelname: JOB
Column: URL
....
0
votes
1
answer
62
views
Extract up to last whole word below a certain character length in bash
I'm trying to copy some files with really long filenames but due to filename length constraints, I need to limit the maximum filename length (which is easy enough by itself) but I don't want the ...
-3
votes
4
answers
292
views
Remove all occurences of substring from variable given prefix & suffix of substring [closed]
As an example, I have a variable containing:
sentence="\<Name\>Mary\</Name\> has a little lamb it's fleece as white as snow and everywhere that \<Name\>Sharon\</Name\> ...
0
votes
0
answers
57
views
Why does str_replace_all work with named vectors but not with dataframe columns? [duplicate]
I have a dataframe with a column which contains strings representing questionnaire items, which can be expressed as ranges, such as "1:1496,3545:4785" etc. Some of these items have names ...
-1
votes
1
answer
66
views
How do I use python to zero pad an integer substring (not a whole string) within another string?
Say I have strings like (outputted from running glob.glob() on output from someone else's code):
image-0.png
image-1.png
image-2.png
image-3.png
image-4.png
image-5.png
image-6.png
image-7.png
image-8....