Word Wrap Function

1. Junior Member
Join Date
Dec 1969
Posts
16

Word Wrap Function

This may seem like an odd request but I was wondering if anyone had a function in vbscript that could put a line feed every 38 characters if there wasn&#039;t one.<BR>So if there was a line that had only 10 characters you wouldn&#039;t mess with it but if the next line had 50 characters you would put a line feed in on the last word break before the 38th character

2. Powers That Be Guest

Code one yourself

duh

3. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

RE: Word Wrap Function

Parse through the string and replace the 39th char with &lt;BR&#062;AndTheChar<BR><BR>then reset the counter to 1 and continue till the last char and ofcourse this will be done only if the len &#062; 38

4. Senior Member
Join Date
Dec 1969
Posts
11,334

RE: Word Wrap Function

So you don<BR>&#039;t mind when wor<BR>ds will be bro<BR>ken between differ<BR>ent lines?

5. Junior Member
Join Date
Dec 1969
Posts
16

RE: Word Wrap Function

But that might break the line in the middle of a word.

6. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

Its HER app...why would i care?? <eop>

.

7. Junior Member
Join Date
Dec 1969
Posts
16

RE: Word Wrap Function

I had something like this but I think it is worthless starts out as 1 and x as 38<BR>Function Breaker(x, i, comment)<BR> For i = i To Len(comment)<BR> If Mid(comment, i, 1) = Chr(10) Then<BR> If i &#060; x Then<BR> i = i + 38<BR> x = i + 38<BR> Else<BR> For y = x To x - 38<BR> If Mid(comment, y, 1) = " " Then<BR> comment = Replace(comment, " ", Chr(10), y, 1)<BR> Exit For<BR> End If<BR> Next<BR> i = y + 1<BR> x = i + 38<BR> End If<BR> End If<BR> Next<BR>End Function<BR>and then if i is less than len comment it would run the function again

8. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

And i care why??...Oh wait i get it

....we were suposed to GUESS it. I forgot that we programmers along with the ability of leaping tall building with with a single bound could also mind read. My mistake.<BR><BR>Read your original post again and tell me HOW i did not answer it? Did you even mention this point?? <BR><BR>and to answer this new requirment, replace the NEXT space after the 38th char with a &lt;BR&#062;<BR>

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•