Hello

I want to do a indexOf but of certain special characters such as

variable.indexOf(''')==-1)
variable.indexOf('/')==-1)
variable.indexOf('\')==-1)
variable.indexOf('"')==-1)

etc, etc. How can I do this?

Recommended Answers

All 3 Replies

That should work, although you need to escape the backslash and single quote. What's the problem?

That should work, although you need to escape the backslash and single quote. What's the problem?

There; How do I "escape"?

Add a backslash before it: '\''

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.