String Function strspn doesn't work? version 3.01

Discuss PocketC for CE (including Desktop Edition)

Postby davidyblood on Sun May 06, 2001 11:56 pm

reading the description of strspn says that it returns an integer value specifying the length of the initial segment of string ......, but then in the return section it says it just returns zero. So exactly how does this function work. it sounds like just the function i need to find a specific word in a string, but i can't figure out how the function works.
Posts: 7
Joined: Tue Dec 05, 2000 12:25 pm
Location: USA

Postby Justinespinosa on Mon May 07, 2001 3:08 am

I think this function returns the place of the first occurance of one of the characters in the second string. not the whole word:
strspn("mm a djht spo u hjas","tzu");
will return 8 (where the "t" is )
strspn("mum a djht spo u hjas","tzu");
will return 1 (where the "t" is )

My help file says:
<td>If string begins with a character that is in strCharSet, the function returns 0, No return value is reserved to indicate an error</td></tr></table>

it doesn't always returns zero.

Edited by - justinespinosa on 05/06/2001 22:09:56

OUTS Softwares
Posts: 156
Joined: Wed Dec 06, 2000 2:30 pm
Location: Switzerland

Postby davidyblood on Mon May 07, 2001 11:39 am

Thanks, I think i understand how it works now.<img src=icon_smile_approve.gif border=0 align=middle>
Posts: 7
Joined: Tue Dec 05, 2000 12:25 pm
Location: USA

Postby goodey on Sun Sep 01, 2002 4:41 pm

I've tried this put it still dosn't seem to work


strspn(s1, s2);

returns 1

but if I change s2 to "bhw" it returns 0 :(

Israel Vish
Israel Vish
Posts: 24
Joined: Wed Jan 17, 2001 10:34 pm
Location: USA

Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 1 guest