LogiView

Function 'strchr'

     

This function returns the location of the first occurance of a search string in a string to be processed. If the substring is not contained in the searched string, this function returns the value zero.

 

Syntax:

  {INT_VAR}= strchr({STR_EXPR},{STR_EXPR})
 

I/O parameters:

{STR_EXPR} String expression to be searched.
{STR_EXPR} Search string
-  
 

Return value:

 
{INT_VAR} Position of the first occurance of the search string.
 

Example:

  Declaration of Variables
 
 10 ask(DOCU_STRING_1,"Enter a word!")	
 20 DOCU_INT_1 = strchr(DOCU_STRING_1,"x")	
 30 if ( DOCU_INT_1== 0 )	
 40   DOCU_STRING_3 = strcat(" \"x\" was not found in ",DOCU_STRING_1,".")	
 50 else	
 60  DOCU_STRING_2 = make_str(DOCU_INT_1)	
 70  DOCU_STRING_3 = strcat("In ",DOCU_STRING_1," a \"x\" was found at place"
     ,DOCU_STRING_2,".")	
 80   endif	
 90 put(DOKU_STRING_3)	
  Result:
 

Functions and commands: Editing Strings