How to remove | from the end of below string

200000|70000|

1)x = “200000|70000|”

2)x=x.substring(0,x.length-1)