From: Dr J R Stockton on 21 Mar 2010 13:25 In microsoft.public.scripting.jscript message <OmiASzEyKHA.5936(a)TK2MSFTN GP04.phx.gbl>, Sat, 20 Mar 2010 12:45:26, Bob Barrows <reb01501(a)NOyahoo.SPAMcom> posted: >capt edgar wrote: >> Hi there >> >> I'm trying to figure out what the following syntax for split means in >> the following line of the code >> >> arrTest[0].split('/')[0] > >You seem to have left out a portion of this statement but ... > >> >> what does ('/')[0] means in split('/')[0]? >> >> please can anyone explain > >It's shortcut for: >var s = arrTest[0] >var arrSplit = s.Split('/') >arrSplit[0] > >In English: >1. Assign the value contained in the [0] element of the array called arrTest >to a variable. >2. Split the content of the variable, which is assumed to be a string >(probably a url, correct?) on the / character, which results in an array >containing the bits of string resulting from that split. For example, if the >string started as "http://www.somesite.com, the array would contain two >elements: "http:" and www.somesite.com. >3. Do something with the value contained in the first element of the >resulting array ("http:"). Should it not give three elements, there being two slashes? If arrTest[0] is not really a string, but is actually a link element, then arrTest[0].protocol might give "http:". OP: DO NOT MULTIPOST - see Wikipedia, It's a good idea to read the newsgroup c.l.j and its FAQ. See below. -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE8 FF3 Op10 Sf4 Cr4 news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>. <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
From: "Trevor Lawrence" Trevor on 21 Mar 2010 23:03 "Dr J R Stockton" <reply1011(a)merlyn.demon.co.uk> wrote in message news:9kG$U4X0ZlpLFwrq(a)invalid.uk.co.demon.merlyn.invalid... > In microsoft.public.scripting.jscript message <OmiASzEyKHA.5936(a)TK2MSFTN > GP04.phx.gbl>, Sat, 20 Mar 2010 12:45:26, Bob Barrows > <reb01501(a)NOyahoo.SPAMcom> posted: >>capt edgar wrote: >>> Hi there >>> >>> I'm trying to figure out what the following syntax for split means in >>> the following line of the code >>> >>> arrTest[0].split('/')[0] >> >>You seem to have left out a portion of this statement but ... >> >>> >>> what does ('/')[0] means in split('/')[0]? >>> >>> please can anyone explain >> >>It's shortcut for: >>var s = arrTest[0] >>var arrSplit = s.Split('/') >>arrSplit[0] >> >>In English: >>1. Assign the value contained in the [0] element of the array called >>arrTest >>to a variable. >>2. Split the content of the variable, which is assumed to be a string >>(probably a url, correct?) on the / character, which results in an array >>containing the bits of string resulting from that split. For example, if >>the >>string started as "http://www.somesite.com, the array would contain two >>elements: "http:" and www.somesite.com. >>3. Do something with the value contained in the first element of the >>resulting array ("http:"). > > Should it not give three elements, there being two slashes? Yes, that is what I wrote (or at least demonstrated) in my reply. Is there a time lag that means that replies don't always get read ? > > If arrTest[0] is not really a string, but is actually a link element, > then arrTest[0].protocol might give "http:". > -- Trevor Lawrence Canberra Web Site http://trevorl.mvps.org
From: Evertjan. on 22 Mar 2010 06:58 Trevor Lawrence wrote on 22 mrt 2010 in microsoft.public.scripting.jscript: > Is there a time lag It is the nature of Usenet that there are wildly varying posting time-lags, and even absence of arrival on or early removal from a specific news-server. > that means that replies don't always get read ? A time-lag is not even needed for that, the fact itself being a fact in fact: Replies don't always get read. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
From: Evertjan. on 22 Mar 2010 07:01 I myself wrote on 22 mrt 2010 in microsoft.public.scripting.jscript: > Trevor Lawrence wrote on 22 mrt 2010 in > microsoft.public.scripting.jscript: >> Is there a time lag > > It is the nature of Usenet that there are wildly varying posting > time-lags, and even absence of arrival on or early removal from a > specific news-server. > >> that means that replies don't always get read ? > > A time-lag is not even needed for that, > the fact itself being a fact in fact: > > Replies don't always get read. Which should not be an excuse for replying that you did not read the above. ;-) -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
From: "Trevor Lawrence" Trevor on 22 Mar 2010 18:01 "Evertjan." <exjxw.hannivoort(a)interxnl.net> wrote in message news:Xns9D437A5745B09eejj99(a)194.109.133.242... >I myself wrote on 22 mrt 2010 in microsoft.public.scripting.jscript: >> Trevor Lawrence wrote on 22 mrt 2010 in >> microsoft.public.scripting.jscript: >>> Is there a time lag >> >> It is the nature of Usenet that there are wildly varying posting >> time-lags, and even absence of arrival on or early removal from a >> specific news-server. >> >>> that means that replies don't always get read ? >> >> A time-lag is not even needed for that, >> the fact itself being a fact in fact: >> >> Replies don't always get read. > > Which should not be an excuse for replying > that you did not read the above. > > ;-) > LOL Re your reply Thanks I have often noticed posts being completely ignored and wondered why -- Trevor Lawrence Canberra Web Site http://trevorl.mvps.org
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Create a folder structure path Next: Split function... popular topic today! |