Does anybody know why the normalizeSpace() or replaceAll() doesn't work with my rich text area field? I tried entering same value that I have on the rich text area and manually adding it on a variable(String manual). They don't show the same result.
for(ENQ_Surveillance_Reports__c eachSR : listSurveillanceReports){
String textArea = eachSR.Test_Rich_Text_Area_Field__c;
String manual = 'Test replace spaces';
System.debug('##textArea: ' + textArea);
System.debug('@@@textAreaNormalized: ' + textArea.normalizeSpace());
System.debug('###manualNormalized: ' + manual.normalizeSpace());
replaced = textArea.replaceAll('\\s\\s+','REPLACED');
String manual1 = manual.replaceAll('\\s\\s+','REPLACED');
System.debug('@@@textAreaReplaced: ' + replaced);
System.debug('###manual1: ' + manual1);
}
This is what shows on the debug logs for normalizeSpace().
17:04:49.0 (50913259)|USER_DEBUG|[176]|DEBUG|##textArea: Test replace multiple spaces with a single space.
17:04:49.0 (50961950)|USER_DEBUG|[178]|DEBUG|@@@textAreaNormalized: Test replace multiple spaces with a single space.
17:04:49.0 (50993445)|USER_DEBUG|[179]|DEBUG|###manualNormalized: Test replace spaces
This is what shows for replaceAll().
17:04:49.0 (51094788)|USER_DEBUG|[183]|DEBUG|@@@textAreaReplaced: Test replace multiple spaces with a single space.
17:04:49.0 (51115244)|USER_DEBUG|[184]|DEBUG|###manual1: TestREPLACEDreplace spaces