5

短信以单个字符串的形式出现,我想将文本分成不同的行,但似乎没有换行符可以解决问题。

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;
                        }
4

2 回答 2

8

这应该工作,使用"而不是'

message = "PrisonerID : " + prisonID + "\n" +
          "Full Name : " + LastName + " " + MiddleName + " " + FirstName + "\n" +
          "Gender : " + Gender;
于 2013-02-19T11:52:38.087 回答
1

使用此代码:

注意:@"\0x0A"

message = "PrisonerID : " + prisonID + @"\0x0A" +
"Full Name : " + LastName + " " + MiddleName + " " + FirstName + @"\0x0A" +
"Gender : " + Gender;
于 2013-02-19T11:43:53.830 回答