...

View Full Version : Help on a Coding Question



georgesofroniou
11-09-2010, 11:03 PM
Hello,

This is my second post on the forum and I am a coding beginner and therefore relatively new to the forum so sorry for any naive ignorance in the questions I may ask.

I was wondering if anyone could please pass their assisstance regarding a functioning question...? :)
I am completely stuck and cannot get my head around it on which methods are necessary?!:confused:

For this question I think I have to follow the specification pretty regimently, eg. the example result has to include the double quotes around 'prog found in pages 0,3,5,6,9'.

v) function findIdxsC(s) - to return a string containing the indexes in the pages array where s was found in the content part, e.g. "prog found in pages 0,3,5,6,9" [Note that this function will not contain an alert]

Example call: findIdxsC("prog")

Example result: "prog found in pages 0,3,5,6,9"


Cheers, George :):thumbsup:

Old Pedant
11-09-2010, 11:37 PM
Two ways to put quote marks (and apostrophes) inside of a string:


var one = "Joe said, \"I'm off to see the wizard!\" ";
var two = 'Mary said, "Actually, he\'s just off." ';

Philip M
11-10-2010, 08:46 AM
Just a thought - does the search for "prog" find whole words only? Or "program", "progressive", "sprog", etc?

georgesofroniou
11-10-2010, 10:15 AM
Thanks Old Pedant

*********************

Philip M... from my understanding if you use prog in the search it should find a whole word such as programme.. therefore the result would be: "prog" found.
Hope that answers your question?? :)

Philip M
11-10-2010, 11:09 AM
Thanks Old Pedant

*********************

Philip M... from my understanding if you use prog in the search it should find a whole word such as programme.. therefore the result would be: "prog" found.
Hope that answers your question?? :)

prog in programme is not a whole word. The whole word is programme. prog is a substring of that word. Example:-


var mystring = "programme";
if (/prog/gi.test(mystring) { // true

if (/\bprog\b/gi.test(mystrong)) { // false



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum