How to compare character ignoring case in primitive types

The Character class of Java API has various functions you can use. You can convert your char to lowercase at both sides: Character.toLowerCase(name1.charAt(i)) == Character.toLowerCase(name2.charAt(j)) There are also a methods you can use to verify if the letter is uppercase or lowercase: Character.isUpperCase(‘P’) Character.isLowerCase(‘P’)

Case insensitive string search in golang

strings.EqualFold() can check if two strings are equal, while ignoring case. It even works with Unicode. See http://golang.org/pkg/strings/#EqualFold for more info. http://play.golang.org/p/KDdIi8c3Ar package main import ( “fmt” “strings” ) func main() { fmt.Println(strings.EqualFold(“HELLO”, “hello”)) fmt.Println(strings.EqualFold(“ÑOÑO”, “ñoño”)) } Both return true.

How can I have case insensitive URLS in Spring MVC with annotated mappings

Spring 4.2 will support case-insensitive path matching. You can configure it as follows: @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); } }

Javascript: highlight substring keeping original case but searching in case insensitive mode

Use a function for the second argument for .replace() that returns the actual matched string with the concatenated tags. Try it out: http://jsfiddle.net/4sGLL/ reg = new RegExp(querystr, ‘gi’); // The str parameter references the matched string // ————————————–v final_str=”foo ” + result.replace(reg, function(str) {return ‘<b>’+str+'</b>’}); $(‘#’ + id).html(final_str);​ JSFiddle Example with Input: https://jsfiddle.net/pawmbude/

How to perform case insensitive diff in Git

The solution is to use git difftool. With the following config command, I can add a custom diff tool called idiff for Git to use: git config –global difftool.idiff.cmd ‘diff -i $LOCAL $REMOTE’ With this customization, I can see the case-insensitive comparison like so: git difftool –tool idiff <other diff options> <Git references or files> … Read more

How can I make the map::find operation case insensitive?

It does not by default. You will have to provide a custom comparator as a third argument. Following snippet will help you… /************************************************************************/ /* Comparator for case-insensitive comparison in STL assos. containers */ /************************************************************************/ struct ci_less : std::binary_function<std::string, std::string, bool> { // case-independent (ci) compare_less binary function struct nocase_compare : public std::binary_function<unsigned char,unsigned char,bool> { … Read more