Insert new line for a string in C/AL Code

SINOEUNSTEVENNEANGSINOEUNSTEVENNEANG Member Posts: 202
Dear
Could you please tell now to insert new for string

A := "Welcome"
B :="Cambodia"

how can i make C become 2 lines ?
C := A + B

waiting for your kindly reply.

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Can you be more clear?
    What do you mean by 2 lines?
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    edited 2012-01-20
    Edit: double post
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    A := 'Welcome';
    B := 'Cambodia';
    C := A + '\' + B;
    
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • SINOEUNSTEVENNEANGSINOEUNSTEVENNEANG Member Posts: 202
    A := 'Welcome';
    B := 'Cambodia';
    C := A + '\' + B;
    

    it work fine with classic report but in RTC report it display "Welcome \Cambodia"
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Did you try \n?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • SavatageSavatage Member Posts: 7,142
    To me the post is confusing beacuse the first post shows
    A := "Welcome"
    B :="Cambodia"

    then you combine them

    c:= a+b
    then you want them seperated on two lines again.

    Is this for a report? The just put the two seperate field togther one under the other.
    :-k

    You mention RTC - so should this post be in forum: NAV Three Tier?
  • ericnericn Member Posts: 2
    edited 2016-03-30
    A good way to force a new line is to use the ascii character for LineFeed. Carrige ride might also be needed. This can be used in Text variables interted into reports.

    Define a text variable.
    variable[1] := 10; //Ascii for Linefeed
    TextString := 'Text' + variable + 'text on new line'
    
    Output:
    Text
    text on new line
  • devdronedevdrone Member Posts: 14
    Just giving a childish answer.

    If you want the string Welcome Cambodia instead of WelcomeCambodia, try giving a space before Cambodia like ' Cambodia'.
  • DuikmeesterDuikmeester Member Posts: 308
    VarMessage := 'Welcome Cambodia';
    VarMessage[8] := 10;     //Replace the 8th character (Space) with a Linefeed
    MESSAGE(VarMessage);
    
Sign In or Register to comment.