0

Find repeating characters in a string

Hi, I want to find the index of a string segment in a string, say ther 3rd comma in a list oif comma seperated values. I want to create a string that will return eveything up to that index value.

i.e.

let x:= find(mystring, ",",6); -----which finds the 6th comma

let y:= substr(myString,0,x-1) ---- whihc returns the string upto the position of the 6th comma minus one

Any ideas?

Thanks

2 replies

null
    • Sean
    • 2 yrs ago
    • Reported - view

    Matthew, is it a JSON string? Can you post an example

    • Luck and Luck
    • Matthew_Luck
    • 2 yrs ago
    • Reported - view

    Here it how I did it in the end:

     

    let s := split('Tags', ",");
    let result := "";
    let a := item(s, 1);
    let b := item(s, 2);
    let c := item(s, 3);
    let d := item(s, 4);
    let e := item(s, 5);
    if a != null then result := a end;
    if b != null then
    result := a + "," + b
    end;
    if c != null then
    result := a + "," + b + "," + c
    end;
    if d != null then
    result := a + "," + b + "," + c + "," + d
    end;
    if e != null then
    result := a + "," + b + "," + c + "," + d + "," + e
    end;
    result

Content aside

  • 2 yrs agoLast active
  • 2Replies
  • 257Views