You need to sign in to do that
Don't have an account?
Surender reddy Salukuti
How can i get number value from string ?
Hi all,
i have one requerement ,
how we can get Number values from string .
eg :string str=' Auto - New Business - Count;Premium - 300 - 400';
i need to get 300 and 400 values from string and need to replace that values with other values
can any one help me on this .
Thanks ,
Surender Reddy
Incase there is no pattern of occurrence like the number is seen after x letters, you can go with REGEX .
You can replace all non number characters with empty characters, and you will have only numbers left. This regex says: any character a-z or A-Z or dash See reference : https://salesforce.stackexchange.com/questions/42003/how-to-extract-a-number-from-a-string that has other approaches too.
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Please use tested code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
you can use split function if you are confirm that before number (Dash ( - ) ) will come then you can use below code. don't forget to mark it as best answer if it is helpful to you.
Thank you
let us know what is your status our code is working fine or not. if yes, then don't forget to mark it as best answer.
thank you