CodeCogs - A iteractive open source Numerical library in C/C++, with wrappers for .NET and Excel Welcome... Login
Site Map
shopping cart
OSX compatibleWindows compatibleLinux compatible
Search CodeCogs
Numerical Components
Worked Examples

Valid RSS

strings

html word wrap

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 0.00
sub units 1.03
add a commercial licence to your cart
0
viewed 2823 times and licensed 11 times

Wraps long lines of html text by replacing spaces with a newline.

Other modules that are used by this module. We add these to the cart for you whenever you add this module, unless you already own enough licences for them. Click for details
Controller: CodeCogs    Contact Controller

+View other versions (2)
Contents hide toc

Interface

#include <codecogs/strings/html_word_wrap.h>

using namespace Strings;

char* html_word_wrap (char* str, int str_len, int length)
Wraps long lines of html text by replacing spaces with a newline.
ExcelString cc_stringsHtml_word_wrap (String str, Integer str_len, Integer length)
This function is available as a Microsoft Excel add-in.

Function Documentation

 
char*html_word_wrapchar*str
intstr_len
intlength )
Ensures that the maximum width of a line (in plain characters) is less than equal to the line length specified. Wrapping is performed on logical word boundaries to ensure words are not broken.

This function is html aware, so any items enclosed in '<' and '>' are ignored and are not included in the line length. This feature is useful when trying to wrap a line for displaying in html, where you don't want to include the html formatting commands.

Warnings:
The function performs an in place substitution of spaces with carriage returns where-ever a new line is needed. As such the provided string is altered, however this ensures that no additional memory needs to be allocated.
Example:
#include <codecogs/strings/html_word_wrap.h>
 
int main()
{
  const char str[]="<strong>CodeCogs is being updated.</strong> We are just installing a <em>new build</em> of this
<font size=\"+3\">website</font>. If you have any problems, then please wait 2 minutes while the configuration files
are updated. <span class=\"orange\">Please also take this opportunity to send us any comments about features you
would like to see.</span>";
 
  printf("%s\n", html_word_wrap(str, strlen(str), 50));
}
Output:
<strong>CodeCogs is being updated.</strong> We are just installing
a <em>new build</em> of this <font size="+3">website</font>. If you have any
problems, then please wait 2 minutes while the
configuration files are updated. <span class="orange">Please also take this
opportunity to send us any comments about features you
would like to see.</span>
Parameters:
strThe character string that needs wrapping. This is also the string returned by this functions.
str_lenThe length of the string provided. Use strlen(str) if you are unsure.
lengthThe maximum length (or width) of any one line. Lines longer than length are wrapped at an appropriate word boundary at a position less than length.
Source Code:

You do not own any licences for this module.
To view or download source code you must get a GPL licence or buy a commercial licence.

buy now     get GPL     add to cart

For advanced download and development options Register with CodeCogs. Already a Member, then Login.


Page Comments

Format Excel Equations

  You must login to leave a messge


Last Modified: 18 Oct 07 @ 17:07     Page Rendered: 2008-11-21 00:02:24

Valid CSS!   Valid XHTML 1.0 Transitional