Questions tagged [string-comparison]

string-comparison is the action of comparing strings, resulting in a boolean or an integer indicating the "distance" between the strings.

Filter by
Sorted by
Tagged with
1 vote
1 answer
40 views

How to properly search for wildcard characters using variables in PowerShell?

When doing string comparison, the -like comparator is my usual go-to solution. But there is one odd thing I cant wrap my head around when using wildcards with variables. String example This will work.....
Dennis's user avatar
  • 1,023
0 votes
3 answers
49 views

Searching for a character in a named list in R

I have a named list and want to search if a character string appears in it. data_list <- list() data_list$item1 <- c("hello_world"="hi", "snooker cue"="cue&...
Basil's user avatar
  • 771
0 votes
1 answer
16 views

Extract difference between 2 strings with ArrayFormula in Google Sheets

I have a list of initial IDs and a list of resulting IDs in Google Sheets - I'm looking to have the third "Leftover IDs" column compare the first two columns and return the difference in ...
Tamara's user avatar
  • 1
1 vote
4 answers
82 views

Cypress - verifying presence of alias or comparing text in alias to string in 'if' statement

I'm creating an API automation suite with Cypress. I have API tests which don't require logging in, and ones that do. I have written a utility method called 'callAPI' which all my tests will use - it ...
Zuno's user avatar
  • 441
2 votes
1 answer
39 views

localeCompare unable to match if the text includes single quote

I am currently working on a Photoshop Plugin which loops over all the text inside each textLayer. I then try to match that text with data from a spreadsheet which contains the same texts. The full ...
Mikkel Fennefoss's user avatar
1 vote
1 answer
57 views

Why does "some string" > 0 evaluate to TRUE in R? [duplicate]

Why does R evaluate "string" > 0 as TRUE? I first thought this might be due to an implicit type conversion or that R interprets this as nchar("string") > 0. This does not ...
Snoeren01's user avatar
  • 379
1 vote
1 answer
44 views

Comparing two different string elements of the same multidimensional array in Java

I'm currently doing a practice question for an upcoming practical exam and am stuck. I've written a method to check whether a set of three cards is valid or invalid where we're told that "Two ...
koder's user avatar
  • 13
0 votes
2 answers
88 views

What is the equivalent in JavaScript of comparing strings in .NET with ordinal ignore case?

In .NET we have the ability to compare strings using an ordinal comparison while ignoring the case. This is a best practice for string comparison especially when multiple cultures could be involved. ...
rory.ap's user avatar
  • 34.2k
-2 votes
1 answer
84 views

Objects.equals() vs StringUtils.isNotBlank() in Java

Could you please explain me if there is a difference between the functionality of the following codes? I know that the Objects.equals() checks for the NULL value first and then compares the two ...
Maryam Koulaei's user avatar
3 votes
2 answers
57 views

word comparison in a line of text in c#

Hi I am using c# language in my project and I am trying to get output something like below. string str1 = "Cat meet's a dog has"; string str2 = "Cat meet's a dog and a bird"; ...
Niranjan's user avatar
  • 147
0 votes
0 answers
9 views

simplehtmldom returning span plaintext is not handled as string

I am getting a plain text from a span with this code $availability = $html->find('span.editable',1)->plaintext; $searchstring = "Άμεσα Διαθέσιμο"; $cleanavailability = trim($...
Gacha SS's user avatar
0 votes
1 answer
52 views

Python: Get substring of a string with a closest match to another string

A nice algorithmic trivia for you today. :) I have two strings – one is a longer sentence and the another one is shorter sentence that was discovered by LLM within the longer one. Let's see an example:...
cadavre's user avatar
  • 1,354
-3 votes
1 answer
83 views

Problems when comparing Strings using the "==" operator (Java 11) [duplicate]

I'm a newbie to Java. Now I'm studying "==" operator with String. I know that in java, string literals are stored in String Pool in Heap area to achieve immutability and memory saving. And I ...
ko-hs's user avatar
  • 1
0 votes
1 answer
63 views

C++ change priority queue to alphabetical order?

I am trying to create a priority queue of pairs, with book names (strings) and lengths (int). I'd like the priority queue to have the earliest title at the top. By default the priority queue is ...
YWH's user avatar
  • 17
1 vote
1 answer
73 views

SQL Server Collation Setting

In the SQL server, the default collation is SQL_Latin1_General_CP1_CI_AS, previously, I used to specify the collation explicitly at the end of each query to SQL_Latin1_General_CP1_CI_AI to ignore the ...
Ⲁⲅⲅⲉⲗⲟⲥ's user avatar
2 votes
1 answer
59 views

An algorithm to fix a subtitle.srt file with ground truth paragraph

I have a subtitle.srt file, but its content is not as accurate as it should be. In parallel, I also have a set of paragraphs that is accurate but not in time synchronized. The inaccuracy can be caused ...
thedebugger's user avatar
1 vote
1 answer
47 views

Assembly 16bit real mode - CMPS return always 0

I want to make a small operating system in 16 bit assembly. In this code I'm creating a sort of 'terminal' where I take the user input and if the input is shutdown then start the function to shut ...
Federico Occhiochiuso's user avatar
1 vote
4 answers
138 views

Python: How to sort a list of custom objects by multiple attributes by different order?

For example, if I have a Person class class Person: def __init__(self, name: str, age: int): self.name = name self.age = age def __repr__(self) -> str: return f&...
maplemaple's user avatar
  • 1,327
1 vote
1 answer
30 views

How to check if one wildcard expression (AKA glob) contains another wildcard expression?

I have two wildcard expressions g1 and g2, and I would like to know whether g1 contains g2. For example: g1 = "*.txt" g2 = "hello*.txt" In this case g1 contains g2.
michael's user avatar
  • 550
0 votes
1 answer
337 views

How golang applies less than and greater than operators to strings?

I'm wondering if only the length of the strings is being compared, or the lexical order is also considered. If anyone knows where it can be viewed in the code - I would be grateful for the link!
Sas Matras's user avatar
1 vote
2 answers
74 views

Read strings out of a file and parse /0 character and utf8 signs right in c

I want to write a Hangman game which randomly chooses a word from a list in a text file. The implementation works if i set a word per initialization: char wort[] = "Apfelbäumchen"; If I ...
ᛉᛉᛉ ᛉᛉᛉ's user avatar
1 vote
1 answer
63 views

Compare values in one column with another column

A2 has cotton,leather B2 has Leather,wool,cotton I need to see if all values in A2 is present in B2 irrespective of case or order or any extra values in B2. So i need a formula which says present in ...
N S's user avatar
  • 91
-2 votes
1 answer
100 views

Why compare operator <,>,= given wrong output when comparing strings? [duplicate]

I am comparing two string using comparison operators(<,>,=). The output of "a" < "b" In this case is 0. #include<iostream> using namespace std; int main() { cout&...
amit_fiend's user avatar
0 votes
0 answers
18 views

Comparing two Strings with different types/lengths of whitespace using Java [duplicate]

I am trying to compare two strings in my program. One is sourced from a spreadsheet the other is sourced from a JSONArray. JSONArray String: "Monday: 7:00 AM – 4:00 PM" Spreadsheet String: &...
Shahnawaz Syed's user avatar
-2 votes
2 answers
66 views

Check an array of strings against another array - Bash

I have two lists. I have to check if there is a tar.gz which name contains a substring like aa or ab and so on. I'm using this little function: How do you tell if a string contains another string in ...
michel's user avatar
  • 11
0 votes
1 answer
135 views

String similarity algorithms

I am comparing products across multiple stores. I only have access to the product name - which often differs between stores. For example: Store 1 might list a product as "iPhone 14 Midnight 128GB&...
user2248702's user avatar
  • 2,859
0 votes
1 answer
24 views

Check if a line from a txt file is a substring of a filename using batch

i have a txt file with several lines, now i want to check if a line is a substring of a filename. this is my code so far for /r D:\ %%y in (*.*) do ( for /f %%x in (list.txt) do ( echo %%y|...
azrilnazrul's user avatar
2 votes
1 answer
98 views

R character that looks like whitespace but is not

I seem to have encountered an enigmatic character in R that breaks my code. I am using R, version 4.2.3. Take the two strings a and b: a [1] "Actinomyces naeslundii" b [1] "Actinomyces ...
Johannes's user avatar
0 votes
1 answer
33 views

How to compare multiple values to find which one is a duplicate, if any?

I have 8 form input values (select inputs). I wish to compare them so that none is identical to another. And if there's a duplicate, I wish to know which one - if they are ABC, then B is a duplicate ...
bafew80778's user avatar
-2 votes
1 answer
87 views

How to Convert a String formatted Big number to Number? [duplicate]

Suppose String num = "14151841515451321511151545" I want to convert this to number = 14151841515451321511151545 I need to convert to Number to compare with another String formatted number ...
shib's user avatar
  • 14
5 votes
1 answer
277 views

Foldcase conversion between (German) lower ß (U+00DF) and upper ẞ (U+1E9E)?

According to Wikipedia, in 2017 using an uppercase ẞ (Unicode U+1E9E) was officially adopted--at least as an option--for what may in fact be a subset of fully-capitalized words in German: In June of ...
jubilatious1's user avatar
  • 2,119
0 votes
0 answers
26 views

Bash one-line if-else based on comparing variable with string literal [duplicate]

I am using a Bash if-else structure based on comparing a variable against a string literal. After reading this Stack Overflow answer and several other suggested Q&As, I tried testing the flow ...
user2153235's user avatar
0 votes
1 answer
223 views

Comparing two json format strings in pandas and assigning label based on matches

I have two columns in my dataframe namely diff and diff2. An instance of diff: {'paths': {'modified': {'/v1/authorization/details/byDate': {'operations': {'modified': {'POST': {'requestBody': {'added':...
Brie MerryWeather's user avatar
-1 votes
1 answer
42 views

Getting strange results, how can I tell if programming error or php error (ussing arrays)?

Before I start, I am not sure if this is a programming error, my misunderstanding of PHP logic, or an error in the PHP program I am using. I am examining documents. I build word-trees arrays, each ...
Howard Cary Morris's user avatar
0 votes
0 answers
32 views

Match Vietnamese names with and without diacritics in C# [duplicate]

I had written a code where i want to compare 2 same names but one is with diacritics eg. Dăn will match with Dan I want to be able to match Vietnamese names with and without diacritics but my code ...
Chew Hong Yu's user avatar
0 votes
2 answers
46 views

Convert an object to string type for comparison

I am reading a csv file and writing its contents to a dataframe. df1 = pd.read_csv(r'/C:/Data.csv', sep=',', names=["a", "b", "c"]) I am later comparing the ...
Passive_coder's user avatar
0 votes
0 answers
25 views

Tcl string saved in variable and text file is different [duplicate]

I have a Tcl script which gets a string back as an answer and saves it in the variable $Data. This string is saved in a txt file later. If I open the file to copy the string and compare it to the ...
daveidix's user avatar
2 votes
1 answer
71 views

IComparer problem in vb.net but same working in C#

I found running code for Natural Sort Alpha-numeric like Windows Explorer in C# and https://dotnetfiddle.net/kBP7EW Dmitry Bychenko wrote some very good code in C# which is 100% working but somehow is ...
Ram's user avatar
  • 131
1 vote
1 answer
58 views

using powershell to append to an existing system variable

Morning everyone, This is a question specific to product licensing. We have many servers hosting licenses for engineering software that share the same variable name but on different servers. So if for ...
cgoldenbus's user avatar
1 vote
1 answer
56 views

Highlight differences in words in df cells

I have a df that looks like this: df = pd.DataFrame({'Before':['one three four', 'apple banana milk'], 'After': ['one two three four five', 'soda banana apple juice milk'], ...
Staw6874's user avatar
1 vote
1 answer
107 views

Trying to write a JS dice game that compares current roll array against all previous rolls, until a set number of unique rolls have been reached

I'm having a lot of trouble figuring this out. I'm new to coding so might be an obvious mistake. The goal is to: Make an array of more than 1 elements or a current roll Compare it to an array of ...
ze hai liu's user avatar
0 votes
1 answer
49 views

it should return the boolean value `True`,or`False`. but it doesn't return anything

a=[1, 2, 3 ,4 ,5] for i in a: even=[] odd=[] for j in a: if(j%2==0): even.append(j) else: odd.append(j) def compareList(even,odd): if(len(odd) > len(even)): ...
Ирина Кейс's user avatar
1 vote
1 answer
36 views

What is a efficient way to encode a string with numbers based on comparison with another string, using a score table?

Let's say we have a score table - score_matrix = t(data.frame('A' = c('A' = 1,'T' = 1,'G' = 2,'C' = 2), 'T' = c('A' = 1,'T' = 1,'G' = 2,'C' = 2), ...
Delta._.43's user avatar
5 votes
2 answers
90 views

Compare a large string with an array of large string for 3 or more consecutive word match in javascript

I have a large string(1000s of words) which i want to compare with all the elements of an array, which contains large strings as well, for all 3 or more consecutive word match. I have implemented it ...
BSA's user avatar
  • 51
2 votes
1 answer
81 views

Putting text file into slice then compare

I am writing a program where I take usernames line by line in a .txt file and verify that the username is in it. I have then created a slice and converted the file into a string and appended it to the ...
Jinevitable's user avatar
1 vote
3 answers
86 views

Efficient way to compare multiple unordered large strings with duplicate characters

I am looking for an efficient way in python to compare multiple large unordered strings with duplicate characters and return true or false depending on if they are the same. Constraints: Characters ...
Faisal Khan's user avatar
0 votes
2 answers
124 views

How to convert pandas dataframe to numpy to improve performance

I am using pandas frame to read in two text file that has 600K rows each and try to find the rows that has matching values between the two files. My current implementation is incredible slow, and I ...
Kevin Lin's user avatar
0 votes
1 answer
64 views

Comparing two strings only works half of the time in Assembly

I made a program that should compare the user input and a string. It does that successfully the first time I type ping and responds with pong, but the second time it doesn't output anything. The third ...
RadoslavL's user avatar
0 votes
2 answers
122 views

How to check which hexadecimal numbers are within a range expressed by hexadecimal numbers?

I have a list of hexadecimal numbers and I want to find what of thi number are within a specific range, without the use of range python function. The list of hexadecimal number is the following: h = [&...
jhonD's user avatar
  • 39
1 vote
1 answer
80 views

Powershell partial string comparison

I'm currently stuck on a specific comparison problem. I have two CSV files which contain application names and I need to compare both csvs for matching names. Of course that would be easy if the ...
Fred Eric S's user avatar

1
2 3 4 5
45