cancel
Showing results for 
Search instead for 
Did you mean: 

how do we read every first character of the string value after "/"...for example 123-/abc/xyz/123..which need to show the result as "ax" in crystal reports

Former Member
0 Kudos

Hi,

Could anybody assist me on this

How do we read every first character of the string value after "/".

.for example 123-/abc/xyz/456

which need to show the result as ax

Thanks,

Nanda

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Abhilash,

Continuous to the same thread can we add ',' or '/ 'in between these

For examle:123/nanda/bangalore/india/567

The output should show the value as N/B/I or N,B,I.

Best Regards,

Nanda

abhilash_kumar
Active Contributor
0 Kudos

Sure:

local stringvar s := {string_field};

local stringvar array ns := split(s, '/');

local numbervar i;

If ubound(ns) > 1 then

(

    for i := 2 to ubound(ns) do

    (

        local stringvar new := new + if ns[i][1] in ['A' to 'Z'] then ns[i][1] + if ubound(ns) <> i then '/';

    );

);

new;


-Abhilash

Former Member
0 Kudos

Thanks Abhilash!!

Best Regards,

Nanda

abhilash_kumar
Active Contributor
0 Kudos

Glad it works! Please close this thread.

-Abhilash

Answers (3)

Answers (3)

Former Member
0 Kudos


Thanks Abhilash for all your help

Sure I will close the thread.

Sorry to ask you on the same question again. Here below I had given how exactly the output should look like

for example: 123-/abc/xyz/456 the output should show as A/X..but where as I am seeing the output as A/X/.. as per present code..could you please help me on this.

Best Regards,

Nanda

Best Re

abhilash_kumar
Active Contributor
0 Kudos

Change the code to:

local stringvar s := {string_field};

local stringvar array ns := split(s, '/');

local numbervar i;

If ubound(ns) > 1 then

(

    for i := 2 to ubound(ns) do

    (

        local stringvar new := new + if ns[i][1] in ['A' to 'Z'] then ns[i][1] + '/';

    );

);

Left(new, len(new)-1);

-Abhilash

Former Member
0 Kudos

Thank You very much.

Best Regards,

Nanda

Former Member
0 Kudos


It has solved my issue..Thank you very much for all your help.

Best Regards,

Nanda

abhilash_kumar
Active Contributor
0 Kudos

Hi Nanda,

Do you mean to say you only want the 'letters' after each '/'?

Try this :

local stringvar s := {string_field};

local stringvar array ns := split(s, '/');

local numbervar i;

If ubound(ns) > 1 then

(

    for i := 2 to ubound(ns) do

    (

        local stringvar new := new + if ns[i][1] in ['A' to 'Z'] then ns[i][1];

    );

);

new;

-Abhilash

Former Member
0 Kudos

Thanks Abhilash,

Let me try the formulae what you have shared.

yes i want letters. but i want to extract only first character of the letter after every "/"

For examle:123/nanda/bangalore/india/567

The output should show the value as NBI.

Best Regards,

Nanda