Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 11-11-2005, 12:03 AM   #1
In Runtime
outlawstar4761's Avatar
Join Date: Jan 2005
Posts: 186
Default JavaScript Help

When using the "indexOf" and "lastIndexOf" operators to count occurences of substrings how can you make JS check for more than one. The example I read only looks for one word. But the one I'm making requires looking for each vowl.


<script language=JavaScript>

var WooT = prompt("plz enter some text: ")

var foundAtPosition = 0;
var wroxcount = 0;

while (foundAtPosition != -1 )
foundAtPosition = WooT.indexOf("A" + "E" + "I" + "O" + "U", foundAtPosition);
if (foundAtPosition != -1)

document.write("There are " + wroxcount + " occurences of capital vowls");


There's the code
outlawstar4761 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 04:41 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0