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

removing whitespaces from string

Status
Not open for further replies.

MrSandman666

Programmer
Feb 5, 2001
54
DE
Hey, it's me again!

This time I'm having problems to find out whether a string actually contains any information. Sometimes I have empty strings of various lenght that contain nothing but blanks. Is there a possibility to test this? strlen() counts blank spaces, so that doesn't work unless there is a way to remove all whitespaces (or only starting and trailing ones). Or is there a function that tests for any 'real' characters in a string?

Thanx in advance (...again...)
 


Cant you just use trim in this case?

If Len(x) = Len(Trim(x)) Then 'etc

Stew
 
Thanks!!!
I didn't know about the Trim() function. For some reason it's not in my VB reference. I knew (and still know;)) that there is a trim function in PHP, so I looked whether they had in VB and all I found was nothingness.

Thanks, that was a great help.
 


It's never that easy.

Still waiting for 'It solved that problem but...'

Stew
 
Well, actually it was that easy. It solved that problem and now everything works perfectly fine. Sometimes "it's the little things" to say it with the words of my dear friend Alice Cooper.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top