length() method can be used to find the length of the String using Apex in Salesforce.
Sample Code:
String myStr = 'abcdef';
Integer result = myStr.length();
System.debug( 'Result is ' + result );

length() method can be used to find the length of the String using Apex in Salesforce.
Sample Code:
String myStr = 'abcdef';
Integer result = myStr.length();
System.debug( 'Result is ' + result );