function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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

thanks 
meghna


 
Amol Rokade 26Amol Rokade 26
Hi Meghna,

Can you use javascript split function as to split ?
 e.g.

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

Please let me know if this helps to you.

Regards,
Amol

 
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
www.kdeepali.com