Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Revisiting GetParm()
Message
From
27/04/2006 13:46:28
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Revisiting GetParm()
Miscellaneous
Thread ID:
01117193
Message ID:
01117193
Views:
57
In VFP, I have a function GetParm() which returns a parameter from a list of specific items delimited by a character, which defaults to the comma. So, the function is like this:
* Return a parameter value from a list
* expC1 Parameter list
* expN1 Parameter number
* expC2 Delimiter (default is the comma)
FUNCTION GetParm
PARAMETERS tcParms,tnNo,tcDelimiter
LOCAL lcDelimiter,lnBPos,lnEPos
IF TYPE('tcDelimiter')<>'C'
   lcDelimiter=','
   ELSE
   lcDelimiter=tcDelimiter
ENDIF
lnBPos=AT(lcDelimiter,lcDelimiter+tcParms+lcDelimiter,tnNo)
lnEPos=AT(lcDelimiter,lcDelimiter+tcParms+lcDelimiter,tnNo+1)
RETURN SUBSTR(tcParms,lnBPos,lnEPos-lnBPos-1)
I was able to benefit of the AT() capability of locating the parameter after a specific number of occurences of the delimiter.

For example, the list of parameters could be like this:

lcParms=",,Test,,,,Test2"

In VB.NET, the INSTR() doesn't have the capability of locating the parameter after a specific number of occurences of the delimiter. So far, I haven't been able to convert that function successfully in .NET to obtain the same thing.

Note that in that particular example, GetParm(lcParms,1) should return "". GetParm(lcParms,2) should return "". GetParm(lcParms,3) should return "Test". So, when there is no parameter, a blank should be returned.

Anyone could provide an equivalent in .NET that would accomplish the same?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform