Find one string in another with case insensitive in Objective-C

As similar to the answer provided in the link, but use options. See – (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask in Apple doc NSString *string = @”hello bla bla”; if ([string rangeOfString:@”BLA” options:NSCaseInsensitiveSearch].location == NSNotFound) { NSLog(@”string does not contain bla”); } else { NSLog(@”string contains bla!”); }

Mysql count instances of substring, then order by

SELECT (CHAR_LENGTH(str) – CHAR_LENGTH(REPLACE(str, substr, ”))) / CHAR_LENGTH(substr) AS cnt … ORDER BY cnt DESC Yep, looks bloated but afaik there is no any other possible solution. mysql> select (CHAR_LENGTH(‘asd’) – CHAR_LENGTH(REPLACE(‘asd’, ‘s’, ”))) / CHAR_LENGTH(‘s’); +—————————————————————–+ | (CHAR_LENGTH(‘asd’) – CHAR_LENGTH(REPLACE(‘asd’, ‘s’, ”))) / CHAR_LENGTH(‘s’) | +—————————————————————–+ | 1.0000 | +—————————————————————–+ 1 row in set … Read more

MySQL Substring return empty value

The SUBSTR start index is 1 in mysql. So, you should change your code to: SELECT SUBSTR(FieldName,1,20) FROM TABLE; Notice that SUBSTR() is a synonym for SUBSTRING() so they can be used interchangeably. You should also checkout the documentation for SUBSTRING()

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)