I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com

Valid RSS

(追記) (追記ここまで)
get GPL
COST (GBP)
this unit 0.00
sub units 1.61
+
0
Strings

html word wrap

Wraps long lines of html text by replacing spaces with a newline.
Controller: CodeCogs Email

get GPL add to cart

Dependents

Info

Interface

C++
Excel

#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.
These functions are available for Microsoft Excel (Login to download):
String cc_stringsHtml_word_wrap (String str, Integer str_len, Integer length)
Use the following HTML code to embed the calculators within other websites:

Html Word Wrap

char*html_word_wrap( char* str
int str_len
int length )
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.

Warning

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 1

#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

str The character string that needs wrapping. This is also the string returned by this functions.
str_len The length of the string provided. Use strlen(str) if you are unsure.
length The 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

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Last Modified: 18 Oct 07 @ 17:07 Page Rendered: 2023年01月22日 22:37:33
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /