Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instring

Status
Not open for further replies.

berthoud

Technical User
Oct 31, 2010
51
FR
How I can have the last "occurence" (in french)of a sign in a string.
I have to know the place of the last \ in a string containing the entire path of a file.

I think, Instring don't works with negative value for step???????

Thanks for answer
 
Hi!

I am not sure what version you are in but one of the C6 versions has a bug i.e. you needed to specify the last char position for the negative step to work. Also, the negative step will work ONLY for a single char search. The usage that will work always is ::

Code:
TheString     STRING(30)

LastBackSlash# = INSTRING('\', TheString, -1, LEN(CLIP(TheString)))

Regards
 
I try this way but don't works with C5. The same think with COPY.

I have C6 at my job (and C5 at home). I try this ways on C6 tomorrow

Thanks

 
Hi!

C5 is VERY LONG AGO. I cannot check to confirm your problem. I currently use C6/C7.

Regards
 
Thank ShankarJ

This way is correct with C6 but don't works with C5.

Yes C5 is old but I'm not a programmer, I use Clarion just for hobby (and a few on job) , so I don't buy all versions.

I try to find a way with C5.

Regards
 
Hi!

In C5, omit the last (Start) parameter and check if it works.

i.e.

LastBackSlash# = INSTRING('\', TheString, -1)

Regards
 
C5ee - Vista

cesure# = INSTRING('\', clip(REP:photo), -1)
message(clip(REP:photo)&' - '&cesure#)

value of cesure# = 0 (the same thing with all letters of the values of REP:photo)


cesure# = INSTRING('\', clip(REP:photo), -1,len(clip(REP:photo)))
message(clip(REP:photo)&' - '&cesure#)

value of cesure# = 1 (the same thing with all letters of the values of REP:photo)
 
Hi!

Since you have wasted a lot time on this, a work around ::

cesure# = 0
LOOP
c# = INSTRING('\', clip(REP:photo), 1, cesure#+1)

IF NOT c# THEN BREAK.

cesure# = c#
END

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top