diff options
-rw-r--r-- | jar/scilab_en_US_help.jar | bin | 11210 -> 11210 bytes | |||
-rw-r--r-- | src/c/string/strcspn/gstrcspna.c | 27 |
2 files changed, 18 insertions, 9 deletions
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar Binary files differindex 42fc9ad..5ab633f 100644 --- a/jar/scilab_en_US_help.jar +++ b/jar/scilab_en_US_help.jar diff --git a/src/c/string/strcspn/gstrcspna.c b/src/c/string/strcspn/gstrcspna.c index 2c83c72..91de8af 100644 --- a/src/c/string/strcspn/gstrcspna.c +++ b/src/c/string/strcspn/gstrcspna.c @@ -14,19 +14,28 @@ #include "strcspn.h" uint8 gstrcspna(char *str1,int size1,char *str2,int size2) { - int ind,i,j; - for(i=0;i<=size2;i++) + uint8 ind=size1+1; + int l,m; + for(m=0;m<size2;m++) { - for(j=0;j<=size1;j++) - { - if(str2[i]==str1[j]) + int tp; + for(l=0;l<size1;l++) { - ind=j; - break; + if(str2[m]==str1[l]) + { + tp=l; + if(ind>tp) + { + ind=tp; + } + } } - } } - return (ind+1); + if(ind==size1+1) + { + ind=size1; + } + return ind; } |