string-comparison

Difference in template rule processing XSLT 1.0 vs 2.0

孤街醉人 提交于 2019-12-12 03:21:53
问题 Answering another XSLT question on this site, I stumbled on a difference between XSLT 1.0 and 2.0 that I don't understand. Who can explain what is happening here, and how the difference may be resolved? Note: I am using XML Spy version 2011 sp1 (x64). My input XML is <?xml version="1.0" encoding="UTF-8"?> <root> <Manager grade="10" id="26"> <Employee id="1" grade="9"/> <Employee id="2" grade="8"/> </Manager> <Manager grade="10" id="27"> <Employee id="3" grade="9"/> <Employee id="4" grade="8"/

JavaScript: String compared with numeric

六眼飞鱼酱① 提交于 2019-12-12 03:14:41
问题 We know that by default, the 'obj' below is string. Without using 'parseInt', how does JavaScript compare it with a number? obj = document.frm.weight.value; if( obj < 0 || obj > 5 ){ alert("Enter valid range!"); return false; } 回答1: If one of the operands of < or > is number, the other one will be casted to a number. alert("3" > 3); // false alert("3.5" > 3); // true EDIT and further explanation: If it is not possible to cast the other parameter into a number, it is casted into the special

String Comparison not working in Ruby

爷,独闯天下 提交于 2019-12-11 11:11:17
问题 I want to compare two values given <% if (current_user.role.title).eql?( "Test") %> but this comparison doesn't seem to work at all. I checked for the value in current_user.role.title and it prints "Test" ; but when i compare it inside the html page this fails. I also tried doing <% if current_user.role.title == "Test" %> but it doesnt work!! The value current.role.title is stored as a Varchar in the database. 回答1: To expand on my comment, it looks like you managed to get a trailing space in

How to modify this script to account for different case?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 09:56:54
问题 I wrote a VBA script which searches for a string in one column and returns the match in another column. The point is match an item number to it's product image by SKU. The problem is that it fails if the case of the item number and the image have different case. The script is below: Sub Test() Dim NA As Long, NC As Long, v As String, I As Long, J As Long Dim v2 As String NA = Cells(Rows.Count, "A").End(xlUp).Row NC = Cells(Rows.Count, "C").End(xlUp).Row For I = 2 To NA v = Cells(I, "A").Value

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

.net string comparison with collation

别说谁变了你拦得住时间么 提交于 2019-12-11 06:36:41
问题 I have 2 different strings ( XXÈ and XXE ). Is there any way to compare them using a collation (for this case, it would be UTF8 general CI - I need them to be equal)? I've seen few examples involving MSSQL or SQLLite - but this would add an unnecessary dependency to my project. So, my question is - is there any way to do this in pure .net (especially c#)? Update: Let's take any decent SQL engine as an example. You can create a table and you can select the collation for the table. In our case,

ActionListener not doing anything [duplicate]

我的未来我决定 提交于 2019-12-11 05:29:18
问题 This question already has answers here : How do I compare strings in Java? (23 answers) Closed 5 years ago . I am new to Java, so please bear with me. I've tried to get a button to open up a new frame called AboutFrame, but whenever I press the button nothing happens. I implement the ActionListener first: class MainFrame extends JFrame implements ActionListener { Then I set the button (after the usual super("blabla");...) JButton info = new JButton("About Failsafe"); info.addActionListener

Subtracting Records from a Set using case-insensitive comparison

巧了我就是萌 提交于 2019-12-11 04:01:08
问题 I have a set of records: type Person = { Name : string Age : int } let oldPeople = set [ { Name = "The Doctor"; Age = 1500 }; { Name = "Yoda"; Age = 900 } ] Unlike the hardcoded example above, the set of data actually comes from a data source (over which I have very little control). Now I need to subtract a set of data from another data source. In general, the data in this second source matches, but occasionally there is a difference in captialization: let peopleWhoAreConfusedAboutTheirAge =

TreeSet example

主宰稳场 提交于 2019-12-11 01:41:42
问题 Why the 3rd object is not being added to the treeset here though it is a different one? import java.util.*; class Student implements Comparable<Student>{ public String fn,ln; public Student(String fn,String ln){ this.fn=fn; this.ln=ln; } //overiding equals public boolean equals(Object o) { if (!(o instanceof Student)) return false; Student s=(Student) o; if(this==s) return true; if(this.fn.equals(s.fn) && this.ln.equals(s.ln)) return true; return false; } //overiding hashcode public int

How do I compare two strings in Forth?

时间秒杀一切 提交于 2019-12-10 21:01:05
问题 And can I do it in an if statement or should I make a helper boolean variable? Here's the code I have so far. By the way, IOX@ is to get input from the user. : var compile: VARIABLE complile: ; : lock compile: var realPass$ compile: realPass$ "password" ! compile: ." Enter Password: " compile: var pass$ compile: IOX@ pass$ ! compile: var match compile: realPass$=pass$ match ! Unknown token: realPass$=pass$ 回答1: The ANS FORTH word to compare strings is COMPARE (c-addr_1 u_1 c-addr_2 u_2 -- n).