Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Finding a string

Former Member
0 Likes
306

Hi,

I am reading one directory and reading files from there.To upload the files into my program I have to make the file path.But my files are named with some prefix characters which is not constant.

Can any one suggest how to find the prefix while reading the file names from the directory?

I have some structure names already present in program.And the file names are named as some "prefix_the structurename.txt".I have to find the prefix.

Edited by: Ginger on Sep 25, 2009 6:42 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
280

Hi Ginger,

Try :

ld_lg_suffix = STRLEN( ld_structurename ) + 4.  " + 4 for the '.txt'
ld_lg_prefix = STRLEN( ld_filename ) - ld_lg_suffix - 1.  " - 1 for the '_'
ld_prefix = ld_filename(ld_lg_prefix).

Best regards.

Samuel

1 REPLY 1
Read only

Former Member
0 Likes
281

Hi Ginger,

Try :

ld_lg_suffix = STRLEN( ld_structurename ) + 4.  " + 4 for the '.txt'
ld_lg_prefix = STRLEN( ld_filename ) - ld_lg_suffix - 1.  " - 1 for the '_'
ld_prefix = ld_filename(ld_lg_prefix).

Best regards.

Samuel