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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String manipulation... quick question

Status
Not open for further replies.

NJCam

Programmer
Sep 10, 2001
12
0
0
US
I've got a string value that wraps onto two lines...

Example:
"Welcome to
my site"

What I want:
"Welcome to my site"

How can I manipulate this string so that it gets "fixed" to one line? Any help would be much appreciated.

Thanks in advance,
- Sam
 
Hi,

You have a line feed character embedded in the string
Code:
Function StripCRLF(MyString As String) as String
sOut = ""
for i = 1 to len(MyString)
  sByte = mid(MyString, i,1)
  select case sByte
   case vbLf, vbCr
     sOut = sOut & " "
   case Else
     sOut = sOut & sByte
  end select
  StripCRLF = sOut
next
hope this helps :)


Skip,
Skip@TheOfficeExperts.com
 
dim test as string
test = Replace(test, vbLf & vbCr, " ")
or
test = replace(Replace(test, vbLf, ""),vdCr, "")


peterguhl@yahoo.de
 
Perfect... thanks again!

- Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top