STRCHR                 ' C style

#include <STRING.bas>                        ' source in /Program Files/Coridium/BASIClib 

FUNCTION STRCHR( string , char )


This FUNCTION written in BASIC searches string looking for the first instance of char .String may be a constant or variable string.
If char is not found -1 is returned, otherwise the position of char.

STRCHR is written in C style with 0 being the first character of the string, consistent with VB string.Chars(0).


#include <STRING.bas> 
DIM text(10)
text = "HELLO WORLD" 
PRINT STRCHR(text, "W")     ' will display  6

Differences from other BASICs

See also