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
vanessa veronvanessa veron 

get value Object into String

Its possible to do this or same:

Thank you
String min='00';
String heu ='17';
String jMois='?';
String leMois='*';
String jSemaine ='[WED]';
String email = 'sggdfgdfgd@ggg.com';
String req='select Name from contact';


BBBB p = new BBBB(email , req, heu, min, jMois, leMois,jSemaine);  
String complete = p;

Best Answer chosen by vanessa veron
Andreas MeyerAndreas Meyer
Hi Vanessa,

assuming that getMail, getRequete are also methods of you class and expressionComplete is a member variable of that class you can do it like that. expressionComplete must be String and getMail and getRequete must return a String as well.

Better you put a declaration in front of the local variable:

public String completeString(){
    String complete = getMail()+'/'+getRequete()+'/'+expressionComplete;
    return complete;
}

Best,
Andreas

All Answers

Andreas MeyerAndreas Meyer
Hi Vanessa,

not sure what you like to do. There is no common function to serialize every object into a String. Of course if  "BBBB" is a apex class you created you can always add a public method to this class (like "public String toString(){....}") which is returning values of the object as a String. A line of code like "String complete = p.toString();" will do what you want. But again ... i am not sure if that is what you are looking for.

Best,
Andreas
vanessa veronvanessa veron
Thank you:

I tried this:
It's correct??

public String completeString(){
    complete = getMail()+'/'+getRequete()+'/'+expressionComplete;
    return complete;
}

Andreas MeyerAndreas Meyer
Hi Vanessa,

assuming that getMail, getRequete are also methods of you class and expressionComplete is a member variable of that class you can do it like that. expressionComplete must be String and getMail and getRequete must return a String as well.

Better you put a declaration in front of the local variable:

public String completeString(){
    String complete = getMail()+'/'+getRequete()+'/'+expressionComplete;
    return complete;
}

Best,
Andreas
This was selected as the best answer
vanessa veronvanessa veron
Thank youuuu