Sunday 23 November 2014

How to convert integer to string in apex

Example of conversion of integer to string

      integer i=123;

      string s1=string.valueof(i);



Example of conversion of string to integer

    string s='123';

    integer i=integer.valueof(s);

capitalize()
Returns the current String with the first letter changed to title case.

String s = 'varaprasad';
String s2 = s.capitalize();
System.debug('convert first letter to capitalize' +s2);

center(Integer)
Returns a version of the current String of the specified size padded with spaces on the left and right, so that it appears in the center. If the specified size is smaller than the current String size, the entire String is returned without added spaces.

String s1 = 'hello';
String s3 = s1.center(9);
System.debug('.put center..' +s3);




No comments:

Post a Comment

Complete Salesforce CPQ training Free videos

Salesforcestart:: We are excited to announce that our YouTube channel, Salesforcestart, is your one-stop-shop for all things Salesforce CPQ!...