Thanks, DD! That should do the trick.
Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY
"The World Leader in Back-lit Mirrors & Mirror TV Technology"
T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of DD
Sent: Monday, July 06, 2009 2:22 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] 4GL Equivalent to InStr?
Sure the Index function should do what you want.
INDEX function
Returns an INTEGER value that indicates the position of the target string within the source string.
Syntax
INDEX ( source , target [ , starting ] )
source
A CHARACTER or LONGCHAR expression.
target
A CHARACTER or LONGCHAR expression whose position you want to locate in source. If target does not exist within source, INDEX returns a 0.
starting
An integer that specifies at which left-most position in the string to start the search. For example, INDEX("abcdefabcdef","abc",6) returns 7.
Examples
For this example, you must enter 1, 2, 3, 4, or 5. The INDEX function checks if the digit exists in the string "12345".
r-index.p
DEFINE VARIABLE x AS CHARACTER FORMAT "9"
LABEL "Enter a digit between 1 and 5".
DEFINE VARIABLE show AS CHARACTER FORMAT "x(5)" EXTENT 5 LABEL "Literal"
INITIAL["One", "Two", "Three", "Four", "Five"].
REPEAT:
SET x AUTO-RETURN.
IF INDEX("12345",x) = 0 THEN DO:
MESSAGE "Digit must be 1,2,3,4, or 5. Try again.".
UNDO, RETRY.
END.
ELSE DISPLAY show[INTEGER(x)].
END.
Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY
"The World Leader in Back-lit Mirrors & Mirror TV Technology"
T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of DD
Sent: Monday, July 06, 2009 2:22 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] 4GL Equivalent to InStr?
Sure the Index function should do what you want.
INDEX function
Returns an INTEGER value that indicates the position of the target string within the source string.
Syntax
INDEX ( source , target [ , starting ] )
source
A CHARACTER or LONGCHAR expression.
target
A CHARACTER or LONGCHAR expression whose position you want to locate in source. If target does not exist within source, INDEX returns a 0.
starting
An integer that specifies at which left-most position in the string to start the search. For example, INDEX("abcdefabcdef","abc",6) returns 7.
Examples
For this example, you must enter 1, 2, 3, 4, or 5. The INDEX function checks if the digit exists in the string "12345".
r-index.p
DEFINE VARIABLE x AS CHARACTER FORMAT "9"
LABEL "Enter a digit between 1 and 5".
DEFINE VARIABLE show AS CHARACTER FORMAT "x(5)" EXTENT 5 LABEL "Literal"
INITIAL["One", "Two", "Three", "Four", "Five"].
REPEAT:
SET x AUTO-RETURN.
IF INDEX("12345",x) = 0 THEN DO:
MESSAGE "Digit must be 1,2,3,4, or 5. Try again.".
UNDO, RETRY.
END.
ELSE DISPLAY show[INTEGER(x)].
END.
--- On Mon, 7/6/09, Thomas Rose <t.rose@...<mailto:t.rose%40electricmirror.com>> wrote:
From: Thomas Rose <t.rose@...<mailto:t.rose%40electricmirror.com>>
Subject: [Vantage] 4GL Equivalent to InStr?
To: "vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>" <vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>>
Date: Monday, July 6, 2009, 3:55 PM
Is there a Progress 4GL equivalent to the InStr VB function? I'm trying to parse a string, and need to know where a particular character is in the string.
Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY
"The World Leader in Back-lit Mirrors & Mirror TV Technology"
T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror. com<http://www.electric mirror.com>
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]