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
Surender reddy SalukutiSurender reddy Salukuti 

I have one requirement i need to get Decimal value from string field

i have one requiremnt i need to get Decimal value from string field how can i get in apex

Eg: String name= '(Aug)NB-Premium 350.00-Sarah Orosco'
from above string name i nedd to fetch 350.00 how can i do that 
and after that i need to replace that 350.00 values to 550.00 value 

like 
String name = '(Aug)NB-Premium 550.00-Sarah Orosco'

how can i do that any one help me on this 

Thank you 

Surender reddy 

CharuDuttCharuDutt
Hii Surender
Try Below  Code
String invalidNumbers = '[^0-9.]';  
String str = '(Aug)NB-Premium 350.00-Sarah Orosco';  
system.debug( 'Only numbers - ' + str.replaceAll( invalidNumbers, '' ) );
Please Mark It As Best Answer If It Helps
Thank You!