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
Nandhini s 11Nandhini s 11 

How to remove all numbers from a text field

I have a text field say,
Name: ABC 1 
I need to extract the field value without the number to another field.
How can i do that?
Result:
(New field) Name truncated: ABC
Soyab HussainSoyab Hussain
Hi Nandhini,
String s1 = '12 I am a 7Salesforce3 developer7'; // this is your string with numeric values
String regExp = '[1-9]'; // create a regex
String s2 = s1.replaceAll(regExp, '');
System.debug(s1); // 12 I am a 7Salesforce3 developer7
System.debug(s2); // I am a Salesforce developer
Use this code this will help you.

Regards,
Soyab