All Courses VU Solved Past Papers

Thursday, May 12, 2011

Re: ::: vuaskari.com ::: it ans required


Here are the string handling related methods of the Stirng object, in full force:


-slice(start, end)

As the name implies, slice() extracts out a substring from the string as determined by the starting and ending points of it's parameters:

var text="excellent" text.slice(0,4) //returns "exce" text.slice(2,4) //returns "ce"

Simple enough, right?

-split(delimiter)

One of my personal favorite, split() cuts up a string into pieces, using the delimiter as the point to cut off, and stores the results into an array. "Say that again?", you say. Consider the following message:

var message="Welcome to JavaScript Kit"

Let's say I want to extract out the individual words ("Welcome", "to", etc) from it. I would do the following:

//word[0] contains "Welcome", word[1] contains "to" etc var word=message.split(" ")

Variable word instantly becomes an array that holds the individual words. This is so because we used a space (" ") as the delimiter, which also is what's separating each word.

To hammer down the point, here's the same message again, manipulated by split() using a different delimiter this time:

var message="Welcome to JavaScript Kit" //word[0] contains "We", word[1] contains "come to JavaScript Kit" var word=message.split("l")

The spit() method is often used to parse values stored inside a cookie, since they are by default separated by semicolons (;), a set delimiter.

-substring(from, to)

Last but not least, we arrive at substring(). This method simply returns the substring beginning with the "from" parameter (included as part of the substring), and ending with "to" (NOT included as part of substring). It behaves just like the slice() method seen earlier. For example:

var text="excellent" text.substring(0,4) //returns "exce" text.substring(2,4) //returns "ce"

i think its substring.
look at the examples.
but you can still check it with someone else too.
SHIREEN GUL
MBA (BANKING)



On Thu, May 12, 2011 at 12:56 PM, ZOYA CH <zoya.chaudhary111@gmail.com> wrote:


ans wid ref plzzzzzzzzzz :'(

How can you references part of a string ?

Text.substr(5,6);

Text.pavt(5,6)

Text.piece(5,6)

Text.split(5,6);


--
REGARDS
 ZOYA CH


--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en

No comments:

Post a Comment

Please Comment About my Work

google-site-verification

Search Any Assignment Solution And Past Papers