Answers for "apex truncate string if it is longer then max size"

0

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);
}
Posted by: Guest on May-14-2020

Code answers related to "apex truncate string if it is longer then max size"

Browse Popular Code Answers by Language