{"id":9325,"date":"2021-06-22T10:05:23","date_gmt":"2021-06-22T17:05:23","guid":{"rendered":"https:\/\/minisoft.com\/support\/?p=9325"},"modified":"2021-06-22T10:05:24","modified_gmt":"2021-06-22T17:05:24","slug":"wordwrap-chunking-a-string-into-fixed-length-pieces","status":"publish","type":"post","link":"https:\/\/www.minisoft.com\/support\/wordwrap-chunking-a-string-into-fixed-length-pieces\/","title":{"rendered":"Wordwrap (chunking a string into fixed length pieces)"},"content":{"rendered":"\n<p>Although using a combination of <a href=\"\/support\/index.php\/create-a-multi-line-variable\/\">concatenation, appending a new line and enabling wordwrap can be used to create multi-line variable<\/a>, there are situations that require a different method. For example, the \u2018<a href=\"\/support\/index.php\/split-string\/\" data-type=\"post\">split string<\/a>\u2019 and &#8216;<a href=\"\/support\/index.php\/regex-replace-video-only\/\" data-type=\"post\">regex replace<\/a>&#8216; functions will accept a <a href=\"\/support\/index.php\/regular-expressions-2\/\" data-type=\"post\">regular expression<\/a>. Depending on circumstances, one of them can be used to insert a space for word-wrap. The following sample illustrates inserting a space every eight characters:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap1.png\"><img decoding=\"async\" loading=\"lazy\" width=\"542\" height=\"396\" src=\"https:\/\/minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap1.png\" alt=\"\" class=\"wp-image-9327\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap1.png 542w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap1-300x219.png 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap1-150x110.png 150w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap2.png\"><img decoding=\"async\" loading=\"lazy\" width=\"349\" height=\"243\" src=\"https:\/\/minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap2.png\" alt=\"\" class=\"wp-image-9328\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap2.png 349w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap2-300x209.png 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap2-150x104.png 150w\" sizes=\"(max-width: 349px) 100vw, 349px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap3.png\"><img decoding=\"async\" loading=\"lazy\" width=\"346\" height=\"226\" src=\"https:\/\/minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap3.png\" alt=\"\" class=\"wp-image-9329\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap3.png 346w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap3-300x196.png 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2021\/06\/Wrap3-150x98.png 150w\" sizes=\"(max-width: 346px) 100vw, 346px\" \/><\/a><\/figure>\n\n\n\n<p>For more information, consult the following resources: <a href=\"https:\/\/minisoft.com\/support\/index.php\/split-string\/\">Split string<\/a>, <a href=\"https:\/\/minisoft.com\/support\/index.php\/regex-replace-video-only\/\">Regex replace<\/a>, <a href=\"https:\/\/minisoft.com\/support\/index.php\/regular-expressions-2\/\">Regular expressions<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although using a combination of concatenation, appending a new line and enabling wordwrap can be used to create multi-line variable, there are situations that require a different method. For example, the \u2018split string\u2019 and &#8216;regex replace&#8216; functions will accept a regular expression. Depending on circumstances, one of them can be used to insert a space [&hellip;]<\/p>\n","protected":false},"author":75,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[47,702],"_links":{"self":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/9325"}],"collection":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=9325"}],"version-history":[{"count":2,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/9325\/revisions"}],"predecessor-version":[{"id":9331,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/9325\/revisions\/9331"}],"wp:attachment":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=9325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=9325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=9325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}