0

I am getting the following id in response "id": "FsuJ6ld97vVC2mkh5bGo5K-us|0000001". I always need to take value before | and ignore the rest of values after us. also value is not consistent, sometimes it's 24 values and sometimes 23. I have used sub String function but that is not very helpful. Let me know how can i do this. Thanks

1 Answers1

0

You can use split() to do that.

let id = "FsuJ6ld97vVC2mkh5bGo5K-us|0000001";
id = id.split("|")[0];
//FsuJ6ld97vVC2mkh5bGo5K-us
lucas-nguyen-17
  • 5,516
  • 2
  • 9
  • 20