apex truncate string if it is longer then max size code example
Example: apex truncate string if it is longer then max size
String sizeString = 'Let\'s Imagine this is more than 120 Characters';
Integer maxSize = 120;
if(sizeString.length() > maxSize ){
sizeString = sizeString.substring(0, maxSize);
}