You need to sign in to do that
Don't have an account?
sheila srivatsav
How to remove white spaces lightning
I have a piece of code in my lightning component as follows
pCodeShortDesc = pCodeShortDesc.subtring(0,28);
this return a string like "Nebuent Inh 300 mg"
I want to remove the two extra white spaces in the above.
Please let me know urgent how to do.
thanks
sheila
pCodeShortDesc = pCodeShortDesc.subtring(0,28);
this return a string like "Nebuent Inh 300 mg"
I want to remove the two extra white spaces in the above.
Please let me know urgent how to do.
thanks
sheila
I would suggest using the trim() function followed by a regex replacement using replaceAll() that matches instances of the space characters i.e. (\\s+) and replaces them with a single space.
Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
All Answers
I would suggest using the trim() function followed by a regex replacement using replaceAll() that matches instances of the space characters i.e. (\\s+) and replaces them with a single space.
Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
sorry I did not phrase question properly
Inside the controller of lightning component the data is coming from api call.
pCodeShortDesc = pCodeShortDesc.subtring(0,28);
this return a string like "Nebuent Inh 300 mg"
Now in UI, when I hover (i.e keep the mouse) it shows as Nebuent Inh 300 mg
I debugged and saw that value from api call is Nebuent Inh 300 mg but I dnot udnerstand when I hover it shows Nebuent Inh 300 mg
please help me out very earliest
sheila
Please refer to these links it may be helpful to you.
https://salesforce.stackexchange.com/questions/1726/remove-whitespaces-in-a-string
https://developer.salesforce.com/forums/?id=906F000000091cXIAQ
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