January 1, 2005

WinTask - StrCSpn

'
' StrCSpn - search a string for the first occurrence of any of a group of characters.
'
' Author: Joe Strazzere

'

'   note: the search IS case-sensitive
'

'dim ptr1 as unsigned
'dim ptr2 as unsigned

'ptr1=allocate(255)
'ptr2=allocate(255)

' the string in which to search
'PokeString(ptr1,"This is, a test",1)

' the group of characters to search for
'PokeString(ptr2,",. ",1)

' returns the number of characters before the found character
'ret=External("shlwapi.dll","StrCSpnA",ptr1,ptr2)
'msgbox(str$(ret))


' returns the number of characters before the found character
ret=External("shlwapi.dll","StrCSpnA","This is a test.","., ")
msgbox(str$(ret))