๐ŸŒ
Linux Hint
linuxhint.com โ€บ strcasecmp-function-c
Strcasecmp Function in C โ€“ Linux Hint
This case comparison function is ... strings that terminate at some null character, e.g. โ€œ/0โ€. Strcasecmp starts comparing the two different strings with the first character in both strings....
๐ŸŒ
Reddit
reddit.com โ€บ r/cs50 โ€บ issues with strcasecmp() and words with apostrophes?
r/cs50 on Reddit: Issues with strcasecmp() and words with apostrophes?
July 17, 2017 -

Hey all,

I'm deep into pset5, and for the most part it has been going well. I'm putting together my "check function," and one of the barriers I've come across is that strcasecmp(), which is what the video and instructions say to use, does not appear to work when the words have apostrophes in them. The program compiles but "freezes up" when attempting to run it. I have to do a ctrl + c to kill the program, otherwise it appears to "freeze/hang" indefinitely. I tried on different software as well and the same result occurred. Even when I tried to run debug50 to try and access the problem more fully, I couldn't even get it to open; the program just freezes.

I tried searching Google, forums, stackoverflow, etc., but couldn't find anything about comparing words with apostrophes in them. I also have not been able to fix this freezing issue. Based on the documentation for strcasecmp(), it doesn't appear that it works with symbols, which might explain why I'm having this issue.

My initial thought is to just write my own function to compare the words and make sure apostrophes are included. That way I avoid this issue...But, since the instructions say to use strcasecmp(), I wanted to reach out and see if you guys have any thoughts/advice on this before I spend all that time and effort writing my own function. I want to make sure I'm not missing something simple...

I'm not looking for someone to spoil the pset; just looking for some help on this annoying issue! :0

EDIT 1: I believe the freezing issue has to do with my particular piece of code. I did some testing on a different, stripped down program and strcasecmp() does appear to work with apostrophes. So I just need to figure out what portion of my code is making it freeze when I add in the apostrophe...If anyone has any ideas, would love to hear 'em!

EDIT 2: So doesn't look like it has anything to do with strcasecmp() at all actually. It has to do with argv[]. Whenever passing a word with an apostrophe in it, e.g., children's, the program freezes. If I pass it a word without an apostrophe, e.g., children, the program doesn't freeze. Here's the simple program I used to test this:

int main(int argc, char *argv[])

printf("%s\n", argv[1]);
return 0;

Not sure why argv makes the program freeze with an apostrophe...Thoughts?

Discussions

Strcasecmp not working in Pset 4
use header file strings.h, which is different from string.h which you usually use. More on reddit.com
๐ŸŒ r/cs50
3
2
June 7, 2018
strcasecmp not working in speller
try strings.h More on reddit.com
๐ŸŒ r/cs50
2
1
March 27, 2022
strcasecmp is unvalid in c99

You need to read the entire error - strcasecmp is not invalid, the implicit declaration of it is invalid. Basically, this means you're trying to use a function without having declared it.

Make sure you've included the correct header for strcasecmp (strings.h)

More on reddit.com
๐ŸŒ r/cs50
4
1
December 22, 2023
Why is the strcasecmp() function not working properly (line 39) or am I doing something incorrectly?

What hash function are you using? If your hash function is case sensitive it won't matter that you're using strcasecmp since you'll be searching the wrong index.

More on reddit.com
๐ŸŒ r/cs50
3
1
March 1, 2018
๐ŸŒ
W3Schools
w3schools.com โ€บ php โ€บ func_string_strncasecmp.asp
PHP strncasecmp() Function
Tip: This function is similar to the strcasecmp() function, except that strcasecmp() does not have the length parameter.
๐ŸŒ
Daemon-systems
daemon-systems.org โ€บ man โ€บ strcasecmp.3.html
strcasecmp(3)
STRCASECMP(3) Library Functions ... len); DESCRIPTION The strcasecmp() and strncasecmp() functions compare the nul-terminated strings s1 and s2 and return an integer greater than, equal to, or less than 0, according to whether s1 is lexicographically greater than, equal to, ...
๐ŸŒ
IBM
ibm.com โ€บ docs โ€บ en โ€บ zos โ€บ 3.1.0
IBM Documentation
We cannot provide a description for this page right now
๐ŸŒ
PHP
php.net โ€บ manual โ€บ en โ€บ function.strncasecmp.php
PHP: strncasecmp - Manual
Binary safe case-insensitive string comparison of the first n characters
๐ŸŒ
YouTube
youtube.com โ€บ watch
Case insensitive compare using strcasecmp() function in C Programming - YouTube
Case insensitive compare using strcasecmp() function in C Programming Connect with me on :https://www.instagram.com/python.hub_genius/https://t.me/genius_dee...
Published ย  November 8, 2024
๐ŸŒ
Litux
litux.nl โ€บ man โ€บ htmlman3 โ€บ strcasecmp.3.html
strcasecmp(3) โ€” Linux manual pages
The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters.
Find elsewhere
๐ŸŒ
Reintech
reintech.io โ€บ term โ€บ understanding-the-strcasecmp-function-in-php
Understanding the strcasecmp() Function in PHP | Reintech media
Learn about the strcasecmp() function in PHP, a built-in, case-insensitive function for comparing two strings. Discover its usage in sorting, filtering, and searching operations.
๐ŸŒ
Code.mu
code.mu โ€บ en โ€บ php โ€บ manual โ€บ string โ€บ strcasecmp
The strcasecmp Function - Case-Insensitive String Comparison in PHP
The strcasecmp function compares two strings case-insensitively. It returns 0 if the strings are equal, a negative number if the first string is less than the second, and a positive number if the first is greater.
๐ŸŒ
The Open Group
pubs.opengroup.org โ€บ onlinepubs โ€บ 009696799 โ€บ functions โ€บ strcasecmp.html
strcasecmp
Upon completion, strcasecmp() shall return an integer greater than, equal to, or less than 0, if the string pointed to by s1 is, ignoring case, greater than, equal to, or less than the string pointed to by s2, respectively.
๐ŸŒ
OnlinePHP
onlinephp.io โ€บ strcasecmp โ€บ manual
strcasecmp - OnlinePHP.io Example
Execute strcasecmp Online. Info and examples on strcasecmp PHP Function from Strings - Text Processing
๐ŸŒ
Linux Man Pages
man7.org โ€บ linux โ€บ man-pages โ€บ man3 โ€บ strcasecmp.3.html
strcasecmp(3) - Linux manual page
The strcasecmp() function performs a byte-by-byte comparison of the strings s1 and s2, ignoring the case of the characters. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ php โ€บ php_function_strncasecmp.htm
PHP String strncasecmp() Function
The PHP String strncasecmp() function is used for string comparison of the first n characters. It is case insensitive. This function is similar to strcasecmp(); the only difference is that you can specify how many characters from each string will be used for comparison.
๐ŸŒ
Karlosoft
manpages.karlosoft.com โ€บ 2.20 โ€บ man3 โ€บ strncasecmp
STRCASECMP(3) - v2.20 | Better Man Pages
The strcasecmp() and strncasecmp() functions return an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2.