compare

Linux shell programming string compare syntax

北慕城南 提交于 2019-12-04 16:07:54
问题 What is the difference between = and == to compare strings in Linux shell programming? Maybe the following code works: if [ "$NAME" = "user" ] then echo "your name is user" fi But I think it's not a correct syntax. It would be used to compare string by == statement. What is correct? 回答1: These pages explain the various comparison operators in bash: http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/ http://tldp.org/LDP/abs/html/comparison-ops.html http://www.faqs

How to compare Enums in TypeScript

痴心易碎 提交于 2019-12-04 14:57:42
问题 In TypeScript, I want to compare two variables containing enum values. Here's my minimal code example: enum E { A, B } let e1: E = E.A let e2: E = E.B if (e1 === e2) { console.log("equal") } When compiling with tsc (v 2.0.3) I get the following error: TS2365: Operator '===' cannot be applied to types 'E.A' and 'E.B'. Same with == , !== and != . I tried adding the const keyword but that seems to have no effect. The TypeScript spec says the following: 4.19.3 The <, >, <=, >=, ==, !=, ===, and !

How to compare two files in Notepad++ v6.6.8

[亡魂溺海] 提交于 2019-12-04 14:54:29
问题 I want to compare values from two different files. In Notepad++ version 5.0.3 we had shortcut button Alt + d but in version 6.6.8 I cannot find any option to compare. Also let me know which version is most stable. 回答1: There is the " Compare " plugin. You can install it via Plugins > Plugin Manager . Alternatively you can install a specialized file compare software like WinMerge. 回答2: I use Compare plugin 2 for notepad++ 7.5 and newer versions. Notepad++ 7.5 and newer versions does not have

Compare value with array and get closest value to it

青春壹個敷衍的年華 提交于 2019-12-04 14:53:31
I'm a rookie in C# and I'm trying to learn that language. Can you guys give me a tip how I can compare an array with a value picking the lowest from it? like: Double[] w = { 1000, 2000, 3000, 4000, 5000 }; double min = double.MaxValue; double max = double.MinValue; foreach (double value in w) { if (value < min) min = value; if (value > max) max = value; } Console.WriteLine(" min:", min); gives me the lowest value of w , how can I compare now? If I have: int p = 1001 + 2000; // 3001 how can I compare now with the list of the array and find out that the (3000) value is the nearest value to my

Git merge/compare tool setup

北慕城南 提交于 2019-12-04 14:49:09
问题 I'm trying to setup CodeCompare as my git merge/diff tool, however I keep getting an error that the following line is incorrect in my .gitconfig file, I am on windows using msysgit cmd = "C:\Program Files\Devart\Code Compare\codemerge.exe" "/TF=$REMOTE" "/MF=$LOCAL" "/RF=$MERGED" "/BF=$BASE" My merge section looks as follows [merge] tool = codecompare [mergetool "codecompare"] cmd = "C:\Program Files\Devart\Code Compare\codemerge.exe" "/TF=$REMOTE" "/MF=$LOCAL" "/RF=$MERGED" "/BF=$BASE"

Comparing NSDate

可紊 提交于 2019-12-04 14:20:24
I would like to compare two NSDates however every date shows as being "Earlier" than todaysDate . Any ideas? let compareResult = self.todaysDate.compare(self.date) if compareResult == NSComparisonResult.OrderedDescending { println("Today is later than date2") } else { println("Future") } To get "todaysDate" let todaysDate = NSDate() let calendar = NSCalendar.currentCalendar() let components = calendar.components(.CalendarUnitHour | .CalendarUnitMinute | .CalendarUnitMonth | .CalendarUnitYear | .CalendarUnitDay, fromDate: todaysDate) let hour = components.hour let minutes = components.minute

comparing elements of the same array in java

非 Y 不嫁゛ 提交于 2019-12-04 13:31:42
问题 I am trying to compare elements of the same array. That means that i want to compare the 0 element with every other element, the 1 element with every other element and so on. The problem is that it is not working as intended. . What i do is I have two for loops that go from 0 to array.length-1.. Then i have an if statement that goes as follows: if(a[i]!=a[j+1]) for (int i = 0; i < a.length - 1; i++) { for (int k = 0; k < a.length - 1; k++) { if (a[i] != a[k + 1]) { System.out.println(a[i] + "

Ruby: Comparing two Arrays of Hashes

故事扮演 提交于 2019-12-04 13:15:58
I'm definitely a newbie to ruby (and using 1.9.1), so any help is appreciated. Everything I've learned about Ruby has been from using google. I'm trying to compare two arrays of hashes and due to the sizes, it's taking way to long and flirts with running out of memory. Any help would be appreciated. I have a Class (ParseCSV) with multiple methods (initialize, open, compare, strip, output). The way I have it working right now is as follows (and this does pass the tests I've written, just using a much smaller data set): file1 = ParseCSV.new(“some_file”) file2 = ParseCSV.new(“some_other_file”)

Compare two list and find names that are in list one and not list two using powershell

戏子无情 提交于 2019-12-04 13:10:18
问题 Just wondering if you can help me out.. I am trying to compare two list(txt file) and find strings that are in list A and not in List B and output it to another txt file.. anybody know how to do it using powershell ? Here is what I have so far: Compare-Object -ReferenceObject $FolderLists -DifferenceObject $AdUserName -passThru I would like to find all strings that are in $FolderLists and not $AdUserName and possibly output it to another variable. The issue I am having is that it outputs

文件对比工具比较表格时显示行号的教程

谁都会走 提交于 2019-12-04 13:07:31
在日常的工作中,数据来自各个方面,在面对庞大且复杂的大数据时,选择一个合适的处理工具显得很有必要,工欲善其事,必须利其器。其中在数据差异处理方面,Beyond Compare是一款十分专业的工具,软件比较功能强大,性能优越。为了提高表格数据的比较效率和满足不同用户的比较需求,在表格比较会话中设置许多便捷操作,接下来就和大家分享一下,使用 Beyond Compare 比较表格数据时显示行号的技巧。 具体操作步骤如下所示 步骤一:打开Beyond Compare软件,在表格比较会话界面中打开需要比较的表格文件,如下图图例所示,左右两侧窗格中的文件每行的最前面都是没有行号的,如果数据内容较多的话,很难找出差异部分的位置信息。 Beyond Compare表格比较会话操作界面图例 步骤二 点击比较会话上方“视图”菜单,在弹出的菜单选项中选择“行号”命令,操作如下图所示。 在视图菜单下执行行号命令示例 步骤三:执行“行号”命令后,再次回到表格比较会话操作界面,我们可以看到左右两侧窗格中的表格数据都显示行号了,这样一来就可以快速知道是第几行的表格数据存在差异,方便查看。 表格比较会话每行最前面显示行号图例 上述内容给大家介绍了使用Beyond Compare比较表格数据时设置显示行号的方法,学会了该项技巧后,不仅方便用户查看表格数据之间的差异部分,还可以提高文件比较效率