0

I build an SMS app in C# but when I sent a message only 150 char message get sent. But my client requirement is to send more than 150 char.

How I can do solve?

BDL
  • 21,052
  • 22
  • 49
  • 55

1 Answers1

0

You can get the count of the string before sending the message/SMS and then Spilt them based on the character count and send it separately.

 string strValue = "qwertyui oplkjhgfds azxcvb nm,. ;'[poerern asyqawqwdhkas,mdbn ahwdasda doiashdkjabdamd aiuasdghkjabdan dakshdkajdbkasdvsa askldhkajdahvd asdhkakjdad kahsdjbajkdbasd";
 int nLength = strValue.Length;

 if (nLength > 150)
 {
    //You can give the count in which you want to spilt the string
    var regex = new Regex(@".{100}");
    string result = regex.Replace(strValue, "$&" + Environment.NewLine+ Environment.NewLine);
    MessageBox.Show(result);
 }

Output result

String spilt based on character count

SH7
  • 732
  • 7
  • 20