Search code examples
splitcrystal-reportsreport

Crystal Report : formula for Splitting string


I have string coming in this: 12345

I want to split the string above to result: 1-2-3-4-5

Pls help me.


Solution

  • If its always 5 digits

    picture("12345","x-x-x-x-x")
    

    or for a string of any length

    stringvar a := "111225678784";
    stringvar b := "x";
    numbervar c;
    stringvar output;
    for c := 2 to len(a) do
    (
    b := b +"-x"
    );
    output := picture(a,b);
    

    replace "111225678784" with your field