/    Sign up×
Community /Pin to ProfileBookmark

indexOf and slash

I’m trying to find the index of a slash plus “v.” I’m using:
if (file_list[x].indexOf(“v.”)>-1)
but it’s not working. If I take out the it works but finds ALL instances of “v.” This is in a node.js script.

Any ideas why this wouldn’t work?

Thanks.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rootMar 07.2017 — If you are using Node.js, then you are in the wrong forum, you need the JavScript Frameworks forum.

The problem you may be having is that v is the match for a vertical tab character.
Copy linkTweet thisAlerts:
@SempervivumMar 07.2017 — [CODE]"\v."[/CODE]is a simple string, not a regexp. No processing of special characters. You need to omit the first "":
[CODE]"v."[/CODE]
×

Success!

Help @Nifty77 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...