Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NewLine Character for sending sms in code behind in C#.net

Tags:

c#

The sms message comes as a single string, I want to break the text into different lines but no newline character seems to do the trick.

sdr.Read();

                        PrisonerStatus = sdr.GetString(0);
                        LastName = sdr.GetString(1);
                        MiddleName = sdr.GetString(2);
                        FirstName = sdr.GetString(3);
                        Gender = sdr.GetString(4);
                        DateOfBirth = sdr.GetString(5);
                        Genotype = sdr.GetString(6);
                        BloodGroup = sdr.GetString(7);
                        DateOfCommittal = sdr.GetString(8);
                        DateOfNaturalExpirationOfSentence = sdr.GetString(9);
                        ActualDateOfRelease = sdr.GetString(10);
                        CellInfo = sdr.GetString(11);
                        Color = sdr.GetString(12);
                        TribeOrCountryOfOrigin = sdr.GetString(13);


                        sdr.Close();

                        if (tokens[2] == "details")
                        {
                            //This is where i need the formating so sms receiver sees it as shown below
                            //PS. Using Ozeki Message server
                            message = "PrisonerID : " + prisonID + '\n' +
                                      "Full Name : " + LastName + " " + MiddleName + " " + FirstName + '\n' +
                                      "Gender : " + Gender;

                            SendToOutbox(message);
                        }
                        else
                        {
                            message = "Unknown transaction code";
                            output.UpdateDisplay("Error :" + message);
                            SendToOutbox(message);
                            goto Label_021C;
                        }
like image 544
nnamchi thomas Avatar asked Feb 18 '13 22:02

nnamchi thomas


2 Answers

This should work, use the " instead of '

message = "PrisonerID : " + prisonID + "\n" +
          "Full Name : " + LastName + " " + MiddleName + " " + FirstName + "\n" +
          "Gender : " + Gender;
like image 60
spajce Avatar answered Nov 08 '22 21:11

spajce


Use this code:

Notice the : @"\0x0A"

message = "PrisonerID : " + prisonID + @"\0x0A" +
"Full Name : " + LastName + " " + MiddleName + " " + FirstName + @"\0x0A" +
"Gender : " + Gender;
like image 32
animaonline Avatar answered Nov 08 '22 20:11

animaonline