string-comparison

MIPS - compare input string to one stored in memory

主宰稳场 提交于 2019-12-06 04:11:36
问题 I have a functioning string compare method written in MIPS (bit by bit comparison of two strings from an input by the user), but I'm trying to update it to compare the second input with one that I have stored in memory. (If those two are equal, I want to use the first string somewhere else). However, I'm running into some issues. Here's my code: .data str1: .space 20 str2: .space 20 msg1:.asciiz "Please enter string (max 20 characters): " msg2: .asciiz "\n Please enter method (max 20 chars):

'Regular Expression' VS 'String Comparison operators / functions'

谁说胖子不能爱 提交于 2019-12-06 00:32:15
问题 This question is designed around the performance within PHP but you may broaden it to any language if you wish to. After many years of using PHP and having to compare strings I've learned that using string comparison operators over regular expressions is beneficial when it comes to performance. I fully understand that some operations have to be done with Regular Expressions down to there complexity but for operations that can be resolved via regex AND string functions. take this example: PHP

R grepl: quickly match multiple strings against multiple substrings, returning all matches

社会主义新天地 提交于 2019-12-06 00:01:53
I have a fairly large set of strings in R: set.seed(42) strings <- sapply(1:250000, function(x) sample(2:20, 1, prob=c( 0.001, 0.006, 0.021, 0.043, 0.075, 0.101, 0.127, 0.138, 0.132, 0.111, 0.087, 0.064, 0.042, 0.025, 0.014, 0.008, 0.004, 0.002, 0.001))) strings <- lapply(strings, function(x) sample(letters, x, replace=TRUE)) strings <- sapply(strings, paste, collapse='') I would like to make a list denoting the presence or absence of each element from a list of substrings within these strings. My starting point, of course, is some code from stackoverflow : #0.1 seconds substrings <- sample

Difference of stricmp and _stricmp in Visual Studio?

允我心安 提交于 2019-12-05 16:23:44
问题 I may asking a stupid question, but I really can't find an answer with google plus I am still a beginner of using MSVS. I recently need to use functions to make comparison of two strings. What I don't understand is the difference of stricmp and _stricmp. They both can be used to compare strings and return the same results. I went to check them: char string1[] = "The quick brown dog jumps over the lazy fox"; char string2[] = "The QUICK brown dog jumps over the lazy fox"; void main( void ) {

String Comparison And Alphabetic Order of Individual Characters

女生的网名这么多〃 提交于 2019-12-05 13:28:49
问题 I have a question related to string comparison vs. character comparison. Characters > and 0 (zero) have following decimal values 62 and 48 accordingly. When I compare two characters in the following code, I get value True (which is correct) Console.WriteLine('>' > '0'); When I compare two one-character strings in the following code, I get value -1 which indicates that ">" is less than "0" (default culture is English) Console.WriteLine(string.Compare(">", "0")); Whereas comparison of "3" and

Compare Strings as if they were numbers

纵然是瞬间 提交于 2019-12-05 13:28:48
I was wondering if it is possible to compare strings as if they were numbers. For instance is there any way you could make it so that "Cat" > "Dog" Since the only way to do this is to keep a set value for each word, you'd be using arrays, or some other form of data storage. Here is an example where you just keep the words, and their corresponding values in two arrays (note, they must be in the same order, so the first word corresponds with the first number, etc). public static String[] words = {"cat","dog","banana"}; public static int[] value = {3,4,5}; public static void main(String[] args){

Check if a string contains specific characters using VBS script

懵懂的女人 提交于 2019-12-05 13:19:52
My script is doing the following point : Retrieve all my selected folder files Class them by date (From the recent one to the older) Show them in a window Here is my VBS Script (I retrieve it here ): Option Explicit Const PathMDB = "C:\Users\C8461789\Desktop\test_script" MsgBox TriRepertoire,,"Enumération " & PathMDB '---lister les fichiers du répertoire --- Function TriRepertoire() Dim fso, fichier, fileItem Dim i, imax, z, valeur, cible, liste Set fso = CreateObject("Scripting.FileSystemObject") imax = 0 'début de l'énumération For Each fichier In fso.GetFolder(PathMDB).Files Set fileItem =

Culture-Invariant case-sensitive string comparison returns different results on different machines

Deadly 提交于 2019-12-05 13:18:20
问题 I've found that the test results are different on my machine and the build server. I've managed to find the single line that differs. This is a string comparison. The two strings differ in case of the first character. The test below passes on my local machine and fails on the build machine. [TestClass] public class Tests { [TestMethod] public void Strings() { Assert.IsFalse(0 == string.Compare("Term’s", "term’s", false, CultureInfo.InvariantCulture)); } } I've also tried to change it to

Ignore case and compare in C# [duplicate]

自古美人都是妖i 提交于 2019-12-05 12:32:36
问题 This question already has answers here : Caselessly comparing strings in C# (6 answers) Closed 6 years ago . How to convert the string to uppercase before performing a compare, or is it possible to compare the string by ignoring the case if (Convert.ToString(txt_SecAns.Text.Trim()).ToUpper() == Convert.ToString(hidden_secans.Value).ToUpper()) 回答1: use this: var result = String.Compare("AA", "aa", StringComparison.OrdinalIgnoreCase); String.Compare Method (String, String, Boolean) 回答2: Case

Case insensitive string comparison in Go

百般思念 提交于 2019-12-05 09:53:58
问题 How do I compare strings in a case insensitive manner? For example, "Go" and "go" should be considered equal. 回答1: https://golang.org/pkg/strings/#EqualFold is the function you are looking for. It is used like this (example from the linked documentation): package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.EqualFold("Go", "go")) } 来源: https://stackoverflow.com/questions/30196780/case-insensitive-string-comparison-in-go