Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

code declaration for search string function

[code]/*check if sub-string s1 exists in string s. if yes, return the
pointer of first character of s that was matched. otherwise, return
null pointer. */
char *isFoundSubS(const char *s, const char *s1)
{
while (*s != 0) {
if (*s == *s1) {
register size_t i = 1;

for (; s1[i]; i++)
if (s[i] != s1[i])
break;
if (s1[i] == 0)
return (char *) s;
}
s++;
}
return 0;
}[/code]

Comments

  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    ___ < http://forcoder.org /> free video tutorials and ebooks about | Java, R, PHP, C#, Delphi, Ruby, JavaScript, Go, Python, Perl, Assembly, Visual Basic, C, C++, MATLAB, Swift, Objective-C, Visual Basic .NET, Scratch, PL/SQL Scala, Ada, Lua, Scheme, Awk, LabVIEW, Apex, D, VBScript, Logo, Hack, Julia, F#, Bash, Alice, COBOL, Erlang, Rust, Transact-SQL, Clojure, SAS, ABAP, Lisp, Kotlin, Prolog, ML, Fortran, Crystal, Dart, FoxPro | ___________

Sign In or Register to comment.