5.0

5.0 | 3 ratings Rate this file 135 downloads (last 30 days) File Size: 2.16 KB File ID: #9909

Line-wrap a string

by Steve Eddins

 

06 Feb 2006 (Updated 06 Mar 2006)

Code covered by BSD License  

Break a string into multiple lines

Download Now | Watch this File

File Information
Description

The function linewrap.m wraps a single string into multiple lines by breaking it at word boundaries. The user can specify the desired maximum number of characters per line.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
07 Feb 2006 urs (us) schwarz

nice exercise with regular expressions, it will get a 5/5 if it handles multiple white-spaces more consistently, eg, with a final DEBLANK(?)
moreover, a pointer to TEXTWRAP, which implements an only slightly different engine, would be nice
us

08 Feb 2006 urs (us) schwarz

for users: a great little helper that wraps your endless line into a nice little parcel (command line output/uicontrols)...
for programmers: look at the remarkable regular expression...
us

06 Mar 2009 matt dash  
Please login to add a comment or rating.
Updates
08 Feb 2006

Implemented suggestions from Urs: Use strtrim on the input string to remove leading and trailing whitespace; use deblank on output array to remove trailing whitespace; add cross-reference to textwrap.

06 Mar 2006

Update keywords and description to make it easier to find this file via search.

Tag Activity for this File
Tag Applied By Date/Time
strings Steve Eddins 22 Oct 2008 08:15:00
string line wrap linewrap Steve Eddins 22 Oct 2008 08:15:00
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com