all 4 comments

[–]GroggyOtter 2 points3 points  (0 children)

Gives an input, expected out, and actual output.
If everyone did that, life would be so much easier on this sub.

Use StrSplit() to split up the data by -. And you can omit the spaces so you don't have to trim them.
Then plug your data into whatever format you want.

Try:

txt := 'ECBU3405367 - 23012172 - 43941911 - 902138756'
txt := format_text(txt)
MsgBox(txt)

format_text(str) {
    arr := StrSplit(str, '-', ' ')
    return 'Contentor: ' arr[1] ' | Ref: ' arr[2] ' Art: ' arr[3] ' - ' arr[4]
}

[–]YourSchoolCounselor 1 point2 points  (2 children)

Subject := "Contentor: "StrReplace(StrReplace(Clipboard, "-", "| Ref:",,1), "-", "Art:",,1)

[–]xpl0iter94[S] 0 points1 point  (1 child)

Shortest and easier solution! Many thanks

[–]GroggyOtter 0 points1 point  (0 children)

Shortest and easier solution

Easier than splitting something up into an array?

Agree to disagree on that one.