LogiView

Function 'strpart'

     

This function returns a substring of an input string. This function requires information on the start position and the length of the desired substring.

 

Syntax:

  {STR_VAR}= strpart({STR_EXPR},{NUM_EXPR},{NUM_EXPR})
 

I/O parameters:

{STR_EXPR} Original string
{NUM_EXPR} Start position (only the integer portion is accounted)
{NUM_EXPR} Length of the substring (only the integer portion is accounted)
-  
 

Return value:

 
{STR_VAR} Substring
 

Example:

  Declaration of Variables
 
 10 ask(DOCU_STRING_1,"File name?")	
 20 DOCU_INT_1 = strchr(DOCU_STRING_1,".")	
 30 DOCU_STRING_2 = strpart(DOCU_STRING_1,1,DOCU_INT_1-1)
 40 put(DOCU_STRING_2)	
  Result: (For DOCU_STRING_1 = test.file)
 

In this example the file extension and the dot (.file) are truncated from a file name (test.file).

Functions and commands: Editing Strings