How to generate a Chinese string of the specified length

Source: Internet
Author: User
How to use "Si yami poem Joshu zi qing Dampe purple autumn Rui Ying Emanline?" These Chinese characters, looping the formation of a plurality of 2 characters of the string?


Reply to discussion (solution)

The stupidest method, the cyclic judging modulus

Take a random number to get 2 words and then plug in the array to print it out.

Who can provide the code, I produce all is garbled. I don't know what the reason is.

$s = ' si yami poem Joshu zi qing Dampe purple autumn Rui Ying Emanline lu Chun Boyun '; $chunk = mb_check_encoding ($s, ' utf-8 ')? 3:2; $a = str_split ($s, $chunk), Shuffle ($a);p Rint_r (Array_map (' Join ', array_chunk ($a, 2)));
  • 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.