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

string remove method not exist error... straight from documentation

So I am trying to call a simple string method to remove a specified set of characters from an existing string, and I keep getting an error message that says: 


Error: Compile Error: Method does not exist or incorrect signature: [String].remove(String) at line 10 column 30


So my code is fairly simple so far, all I have is this

trigger updateTextEmail on Contact (before insert, before update) {

    List<String> contactNames = new List<String>{};

    for(Contact c:{

        if (c.MobilePhone != '') {
           String phone = c.MobilePhone;
           String numPhone = phone.remove('()- ');




So why doesn't the remove method work? I have copied and pasted the method example straight from the documentation, and even that throws an error. Is there something I have to import/include? 


Thanks in advance


The Remove method is new to the Winter 13 release - so check the org you are developing on has been upgraded, and/or the classes you are using are using API v 26


Is this method new for Winter '13?  I haven't used it before, wondering if its new and not released to your org yet.


You could use the replace method instead for now.


BritishBoy, I just missed your reply!