Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting number of characters in string

Status
Not open for further replies.

meldrape

Programmer
May 12, 2001
516
US
Hi all,

I need to be able to count the number of characters in a line and add a &quot;<BR>&quot; tag, like a replace function, but I don't know the syntax. Any help would be greatly appreciated. Right now I have:

text=replace(text,vbCrLf,&quot;<BR>&quot;)
This isn't working because there are no actual hard returns in the text. It's actually text from an email and copied and pasted into a textarea. If think if I knew how to count characters through code, I could insert a &quot;<BR>&quot; after a certain number... Any help would be GREATLY appreciated! Thanks in advance.
 
see if this works (or something close):

textB = &quot;&quot;
For i = 1 to Len(text) Step 60
textB = textB & Mid(text,1,i) & &quot;<BR>&quot; & Mid(text,i,Len(text))
Next
text = textB

Kris
- In case of doubt, make it sound convincing.
 
correction:

I think:

For i = 1 to Len(text) Step 60

should be:

For i = 60 to Len(text) Step 60

or what ever number of characters make up a line.

Kris
 
See your other post for a possible solution to your original problem
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top