From: William P. Y. H. <wil...@gm...> - 2006-01-01 05:15:15
|
I've done the following: 1. Changed the help text of the strcmp function to reflect its ability to accept cell arrays as arguments. 2. Simplified the strcmpi and strncmp functions. 3. Imported strncmpi from octave-forge and simplified it. 4. Written the strtrunc function. Explanation: 1. strcmp is actually already compatible with Matlab's strcmp, so I just added the help text. 2. The implementations of strcmpi, strncmp, and strncmpi (octave-forge) are too complex, IMO, so I simplified them. 3. But the changes made to strncmp and strncmpi needs strtrunc, so I wrote = it. 4. strtrunc takes a string or cellstr as its first argument (s), then truncates it to the value of the second argument (n). Although strtrunc is not present in Matlab, I think this is useful, so I'm sending it here. I hope John would accept this. The attachments: 1. str2.diff.txt: diff for strcmp, strcmpi, strncmp 2. str2.ChangeLog.src.txt: changelog entry for strcmp 3. str2.ChangeLog.scripts.txt: changelog entry for strcmpi, strncmp, strncmpi and strtrunc 4. strncmpi.m.txt, strtrunc.m.txt: the corresponding functions -- William Poetra Yoga Hadisoeseno |