find strings without ascii characters in them

I am stripping out words in strings, in some cases I am left not with empty strings but with some spaces left.

How can I identify those?

finding spaces in strings wont work as strings with words naturally have spaces between them.

Its spaces in strings with no other characters

I am doing this as a function in vba
PeterBaileyUkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
It isn't clear what your difficulty is. Once you have removed the words from a string, you could well be left with spaces. Are these a problem for you?
Perhaps we need a better understanding of your objective and/or an example.
0
PeterBaileyUkAuthor Commented:
when the words are removed its leaving what appears to be empty strings but they are not, the strings are void of what we call words but none, one or more spaces are left.

I need to find those strings without exclusively searching for spaces as a string with words in it has spaces.

so how do i identify:

"  "
"   "

without pulling out "hello world "
0
PeterBaileyUkAuthor Commented:
if the string doesnt have any readable character, if i were to try verbalise this.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Gustav BrockCIOCommented:
Replace "  " (two spaces) with " " (one space) and/or apply Trim() to the result strings.

/gustav
0
GrahamSkanRetiredCommented:
It depends on what is displaying the string as to whether a character is readable, but try this function:
Function StripASCIIControls(strMyString As String) As String
    StripASCIIControls = strMyString
    For i = 0 To 31
        StripASCIIControls = Replace(StripASCIIControls, Chr(i), "")
    Next i
End Function

Open in new window

0
PeterBaileyUkAuthor Commented:
it could have an unknown qty of spaces, in my first example it only has one space but could be many. I tried the function here but that doesnt work with the row i found which makes sense as it stops at chr31.

let me show long hand what i am doing:

I had  client strings that were for example:
"3 series BMW 316 SE"
"3 series BMW 316"

I have code that strips away elements so "3 series" gets removed as does the 3 digit model and marque. so leaves me with:
"SE" this is fine this is the trim level of the vehicle.
in the other case i end up with:

" "

what this means is my removal routines removed the words and leaves remnants being the spaces qty unknown. As far as the vehicle goes this is a base model with no trim so I want to identify this (as per the question) and I could add maybe the word "[no trim]" to the string if thats easier.

Hope you see now what I am doing now helps understand the wider scope.
0
GrahamSkanRetiredCommented:
That is a bit clearer. How about?
Function IsBaseModel(strMyString As String) As Boolean
    If Len(Trim(strMyString)) = 0 Then
        IsBaseModel = True
    End If
End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeterBaileyUkAuthor Commented:
Apologies sometimes its hard to verbalise the problem, works perfectly.
0
PeterBaileyUkAuthor Commented:
I am assuming it would work the same with multiple spaces in the string.
0
GrahamSkanRetiredCommented:
Yes, If there are only spaces left in the string, the Trim function will return a zero-length string.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.