فحص تساوي شريطين محرفيين بغض النظر عن حالة الأحرف
كود:
int equals(const char* a, const char* b) { assert(a && b); while (*a && *b) { int c1=*a; if (c1>='A'&&c1<='Z') c1+='a'-'A'; int c2=*b; if (c2>='A'&&c2<='Z') c2+='a'-'A'; if (c1!=c2) return 0; ++a; ++b; } return *a==*b; }
Copyright (C) 2007 Matt Mahoney
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
تعليق