comparison

php case-insensitive comparison of russian characters

梦想的初衷 提交于 2019-12-11 10:28:19
问题 How can I compare russian characters case insensitively. I have tried: if(strcasecmp($content->title, 'О нас') == 0){ $about=$content->title; } and also if(strtolower($content->title) == strtolower('О Нас')){ $about=$content->title; } both of them didn`t work. if I make both strings in the same 'case' it returns true, otherwise false. $content->title returning 'О Нас' from Mysql databse and second string is also 'О Нас' but if I make second str 'О нас' and use one of the above comparison it

Comparing int with long and others

老子叫甜甜 提交于 2019-12-11 10:18:57
问题 I am wondering if things like this : int a = ...; long b = ...; if (a < b) doSomethings(); always works (excepted for unsigned) I just tested with a few values, but I want to be sure. I assume a is cast to long in the comparison, what about others type ? 回答1: int/long compare always works. The 2 operands are converted to a common type, in this case long and all int can be converted to long with no problems. int ii = ...; long ll = ...; if (ii < ll) doSomethings(); unsigned/long compare always

C# - Dictionary - File Path (Custom EqualityComparer)

人走茶凉 提交于 2019-12-11 09:39:47
问题 Problem: Custom Object implements EqualityComparer and IEquatable, but Dictionary doesn't always use these methods. Context: I have created a helper class, FilePath for dealing with file paths instead of treating them as strings. The helper class is responsible for determining if two file paths are equal. I then need to store FilePaths in a Dictionary<FilePath, object> . Goal: Assert.True(new FilePath(@"c:\temp\file.txt").Equals( new FilePath(@"C:\TeMp\FIle.tXt")); var dict = new Dictionary

comparing hours and minutes to current time in batch file

余生颓废 提交于 2019-12-11 09:38:03
问题 I am currently working on a batch file that will compare the current time to a specified time before starting a program. i.e: The batch file checks if it's past 10 am. If it is it start the program. If not, it sends a message telling that the program can't be open before 10 am. If it's past 6 pm, the program won't start and a message appears. This is my code, for now: @echo off Set _hourAM= Set _minAM= Set _hourPM= Set _hourPM= If %_nowh% GEQ %_hourAM% If %_nowm% GEQ %_minAM% ( If %_nowh% LSS

Function or other basic script that compares values on two variables in a dataframe using an id variable located in both

好久不见. 提交于 2019-12-11 08:12:29
问题 Let's say you have two data frames, both of which contain some, but not all of the same records. Where they are the same records, the id variable in both data frames matches. There is a particular variable in each data frame that needs to be checked for consistency across the data frames, and any discrepancies need to be printed: d1 <- ## first dataframe d2 <- ## second dataframe colnames(d1) #column headings for dataframe 1 [1] "id" "variable1" "variable2" "variable3" colnames(d2) #column

Switch statement where value is Int but case can contain array [duplicate]

谁说胖子不能爱 提交于 2019-12-11 08:09:58
问题 This question already has answers here : Swift switch pattern matching with arrays (2 answers) Closed 2 years ago . I want to put my array of values as a case for my switch statement I have an array of values say let intValues = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 .... 100] and I want to use a switch statement to be used as a comparison tool like so. let inputValue = 30 // or some other int value switch inputValue { case 101: // do something lol /* ============================

Find minimum in array of numbers using Verilog for Priority Queue implementation

心已入冬 提交于 2019-12-11 07:19:03
问题 I'm quite a novice to Verilog, but I have an array of 16-elements (each element is 16-bits long) and I wish to find the minimum entry the array, return the minimum, and re-arrange all the entries in the array that come after the minimum so that the array is one contiguous block of entries. I know I have to use a comparator, but I really have no idea where to start with regards to comparing a large group of numbers and determining the minimum. EDIT: What I'm actually making is a priority queue

Comparing a User Input to an already established table's column

人盡茶涼 提交于 2019-12-11 07:04:46
问题 I have a User Input coming into the database to get compared to a table's column. I've finding a ton of information on a column comparing another column, which didn't seem to work correctly. Here's my code: CREATE Procedure Check_Previous_Passwords @ua_pk uniqueidentifier, @IncomingPassword varchar(25) AS DECLARE @TempTable TABLE (Passwords varchar(25)) INSERT INTO @TempTable SELECT * FROM User_Passwords WHERE ua_fk = @ua_pk IF @IncomingPassword = @TempTable.Passwords --Then do stuff GO I'm

what is the difference between “some” == “some\0” and strcmp(“some”,“some\0”) in c++?

懵懂的女人 提交于 2019-12-11 06:48:50
问题 what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? Why if("some" == "some\0") returns false and if(!strcmp("some","some\0")) returns true ? 回答1: See the following diagram. It shows two strings in memory, their content is in the box, beside the box you'll see the address of each one. When you're doing if("some" == "some\0") you are comparing the addresses. It is translated into if (0xdeadbeef == 0x0badcafe) which is obviously false. When you use strcmp , you

Java: HashMap.get returns null

独自空忆成欢 提交于 2019-12-11 06:44:24
问题 I am programming a socket server in Java for an MMORPG in AS3. I have some problems with strange behaviour of HashMap.get(byte[]). What things could cause the following problem? I don't use any serialization system, I send bytes and both client and server knows what to do with what bytes of the received bytes. The first request the client makes is asking the server to create a playing session. The server will generate a random session token as byte[] with 8 entries and adds the token to the