function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
o rajuo raju 

How to remove left and right values in a string?

Hi,

        My string is looks like String name='rajesh__'+strfieldname+'__c';

Here how to remove rajesh__ and __c

I want to strfieldname only

help me......
Vamsi KrishnaVamsi Krishna
raju,
you can try 2 different ways..

split the string based on double underscore and take the second value in the result array

String actualName = name.split('__')[1];

or if the prefix & suffix are always rajesh__ and __c then you can replace them with empty string to get back only the middle part..

String actualName = name.replace('rajesh__','').replace('__c','');
o rajuo raju
Hi Vamsi Krishna,
                               Thank you its working.Yesterday i was asking one question


                                        In  an object records inserted but I gave some field values(like amount,name(Here fields i displayed dynamically with out using fieldset)) related to object and click save only record inserted related object but field values not inserted in database.

please help me.......