+ Start a Discussion
meghna nmeghna n 

split expression value

I have as follows in lightning component

distance=2416.63 miles

I want to have as distance=241.63
so pls let me know how to use split function or is there any other method


Amol Rokade 26Amol Rokade 26
Hi Meghna,

Can you use javascript split function as to split ?

var str = "How are you doing today?";
var res = str.split("");

Please let me know if this helps to you.


Deepali KulshresthaDeepali Kulshrestha
Hi Meghna,

Greetings to you!

Use the below code. It must provide solution of your problem

var str = "241.63 miles";
var res = str.split(" ");

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha