Is it possible to check if character "," exist in a string?

  • Thread starter Thread starter Niklas Östergren
  • Start date Start date
N

Niklas Östergren

Hi!

Is it possible to check if caharcter "," (colon) exist in a string?

What I need to do is tho check a string which is imported into my db. The
imported string can hold following values:
- ""
- "0"
- "157"
- "157,256,875"

If the string is either "" och "0" then I do something. If it is "157" (or
any other number representing ONE MemberNo) then I do something else. And
finaly if the string is "157,563,578,589" (representing several MemberNo)
then I do somethinge else again.

I know one way of checking this which is by using Split() and to copy the
value into an array and then check UBound for the array to see how many
Indexes was created. An maby this is the way I have to go, since I anyway
have to split it when I have several MemberNo stored in this String. And I
need to be able to handle this situation anyway.

But is there any other way of finding out if "," exist in the string?

TIA!
// Niklas
 
Yes. You can use InStr function:

InStr(1,"Hello, world",",")

Luiz Cláudio C. V. Rocha
São Paulo - Brazil
 
OK!

Thank´s I´ll try this tomorrow!

Good Night! ;-)

Thank´s for a quick reply!

// Niklas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top