MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

JavaScript Tutorial

String In JavaScript
Previous Home Next

A JavaScript string simply stores a series of characters like "prasun".

Creating a String object

Syntax :

var val = new String(string);

String Properties:

Property Description
constructor Returns a reference to the String function
length Returns the length of the string.
prototype The prototype property allows you to add properties and methods to an object.

 

String Methods :

Property Description
indexOf() Returns the index within the calling String object of the first occurrence of the specified value
concat() Combines the text of two strings and returns a new string.
charAt() Returns the character at the specified index.
charCodeAt() Returns a number indicating the Unicode value
match() match a regular expression against a string.
replace() Searches a string for a value and returns a new string with the value replaced
localeCompare() Compares two strings in the current locale
slice() Extracts a section of a string and returns a new string.
substring() Returns the characters in a string between two indexes into the string.
toString() Returns a string representing the specified object.
toLowerCase() Returns the calling string value converted to lower case.
toUpperCase() Returns the calling string value converted to uppercase.
valueOf() Returns the primitive value of a String object
split() Splits a string into an array of substrings

String HTML wrappers :

Method Description
blink() Creates a string to blink as if it were in a <blink> tag.
bold() Creates a string to be displayed as bold as if it were in a <b> tag.
anchor() Creates an HTML anchor that is used as a hypertext target.
fontcolor() Causes a string to be displayed in the specified color as if it were in a <font color="color"> tag.
fixed() Causes a string to be displayed in fixed-pitch font as if it were in a <tt> tag
link() Creates an HTML hypertext link that requests another URL.
sub() Causes a string to be displayed as a subscript, as if it were in a <sub> tag
sup() Causes a string to be displayed as a superscript, as if it were in a <sup> tag
Previous Home Next