Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!guardian.oit.duke.edu!news.glorb.com!news2.glorb.com!tr22g12.aset.psu.edu!news.mathforum.org!not-for-mail
From: NouveauIX <visualxd@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Compare strings of different lengths without using strcmp?
Date: Thu, 24 Sep 2009 16:09:00 EDT
Organization: The Math Forum
Lines: 11
Message-ID: <1060919098.4446.1253822970612.JavaMail.root@gallium.mathforum.org>
NNTP-Posting-Host: gallium.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1253822970 13802 144.118.94.39 (24 Sep 2009 20:09:30 GMT)
X-Complaints-To: news@news.mathforum.org
NNTP-Posting-Date: Thu, 24 Sep 2009 20:09:30 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:572731


I'm trying to compare two strings with if statements without using strcmp.

function log=myStrCmpI(char1,char2)
c1=lower(char1);
c2=lower(char2);
if ?
    log=true;
else log=false;
end

I tried taking the sum of c1-c2 but that doesn't work for all cases, such as if the strings are the same but have a couple letters switched around.