WeChat public account development tutorial 7th-use of line breaks in text messages

Source: Internet
Author: User
Although I have been unable to write my blog for the last month, I have been answering your questions carefully. I have a sense of accomplishment after receiving so many replies, attention, and thanks. This makes me feel more and more meaningful and makes me more determined to continue writing. After explaining the previous six articles, I believe you are reading the article.

This article describes the benefits of using line breaks in text messages and how to use line breaks.

Although I have been unable to write my blog for the last month, I have been answering your questions carefully. I have a sense of accomplishment after receiving so many replies, attention, and thanks. This makes me feel more and more meaningful and makes me more determined to continue writing. After explaining the previous six articles, I believe that you have mastered the basic development knowledge (based on Java) of the public account ), such as framework construction, API encapsulation, message receiving and reply; the next series of articles will focus on the development of skills and practical functions in public account development (such as weather query, nearby search, man-machine conversation, etc ).


Benefits and examples of using line breaks

The advantage of using line breaks is to make the information appear more neat, beautiful, and intuitive. using line breaks in text messages will make people feel comfortable, clear, and clear. Below is a public accountXiaoqrobotThe main menu example is to use a line break reasonably. does it look intuitive and refreshing? (What? I think it's ugly? Well, that would be my narcissism ...)

You can imagine what it will look like if this text menu does not use a line break?


How do I use line breaks in text messages?

In text messages of public accounts, the linefeed is still "\ n". the following code is used to explainXiaoqrobotHow is text menu implemented?


[Java]View plaincopyprint?
  1. /**
  2. * Main menu of xiaoqrobot
  3. *
  4. * @ Return
  5. */
  6. Public static String getMainMenu (){
  7. StringBuffer buffer = new StringBuffer ();
  8. Buffer. append ("Hello, I am a small Q. please reply to the number selection service:"). append ("\ n ");
  9. Buffer. append ("1 weather forecast"). append ("\ n ");
  10. Buffer. append ("2 bus query"). append ("\ n ");
  11. Buffer. append ("3 search"). append ("\ n ");
  12. Buffer. append ("4 songs on demand"). append ("\ n ");
  13. Buffer. append ("5 Classic Games"). append ("\ n ");
  14. Buffer. append ("6 "). append ("\ n ");
  15. Buffer. append ("7 face recognition"). append ("\ n ");
  16. Buffer. append ("8 chat "). append ("\ n ");
  17. Buffer. append ("reply"?" Show this help menu ");
  18. Return buffer. toString ();
  19. }
/*** Main menu of xiaoqrobot ** @ return */public static String getMainMenu () {StringBuffer buffer = new StringBuffer (); buffer. append ("Hello, I am Xiao Q. please reply to the number selection service :"). append ("\ n"); buffer. append ("1 weather forecast "). append ("\ n"); buffer. append ("2 bus query "). append ("\ n"); buffer. append ("3 search "). append ("\ n"); buffer. append ("4 songs on demand "). append ("\ n"); buffer. append ("5 Classic Games "). append ("\ n"); buffer. append ("6 "). append ("\ n"); buffer. append ("7 Face recognition "). append ("\ n"); buffer. append ("8 chat "). append ("\ n"); buffer. append ("reply"?" Show this help menu "); return buffer. toString ();}

How about it?

1) Lines 9-16 are menu items, which are separated by a line break;

2) There are two line breaks at the end of line 8th and line 16th, which can separate the menu items from other contents. This gives you a sense of comfort and looks more comfortable and intuitive.


A careful friend may have discovered that there is a "gift" behind "nearby search" and "beauty station", which is not seen in the code, this is what I specifically removed, because I plan to use an article later to clearly describe the sending, processing, and receipt of QQ expressions.

Details determine success or failure!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.