Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Character strings---picking out substrings
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00125430
Message ID:
00125466
Views:
12
Hi,

>I have to go through a table and choose part desriptions...I need to remove the string within the parentheses to place in a report. HELP!!
*!*********************************************
*!
*!       Procedure: within
*!
*!*********************************************
*) Description.......: Returns string contained within two
*)                     others.  Case sensitive
*] Dependencies......:
*  Calling Samples...: within( <expC>, <expC>, <expC> [,<expN> [,<expN>]])
*  Parameter List....: tcExpression
*                      tcLeft
*                      tcRight
*                      tnFirstOne
*                      tnFollowing

PROCEDURE within
PARAMETER tcExpression, tcLeft, tcRight, tnFirstOne, tnFollowing

LOCAL lcReturnVal, tnLeftpos
lcReturnVal = []
tnLeftpos = AT( tcLeft, tcExpression, IIF( EMPTY( tnFirstOne), 1, tnFirstOne))
IF tnLeftpos> 0
  tnLeftpos = tnLeftpos+LEN( tcLeft)
  IF tnLeftpos< LEN( tcExpression)
    lcReturnVal = SUBSTR( tcExpression, ;
                          tnLeftpos, ;
                          AT( tcRight, ;
                              SUBSTR( tcExpression, tnLeftpos), ;
                              IIF( EMPTY( tnFollowing), 1, tnFollowing))-1)
    ENDIF
ENDIF
RETURN lcReturnVal
Previous
Reply
Map
View

Click here to load this message in the networking platform