Unit Eleven: Legal Issues
Unit Five: XML, DTD, XSTL, XHTML
Unit Four: XML and XHTML
Unit One: Web Environment
Unit Seven: Server Side Scripting (PHP)
- Introduction to PHP || Server Side Scripting || OnlineNotesNepal
- Variables in PHP || Server Side Scripting || OnlineNotesNepal
- Data Types in PHP || Server Side Scripting || OnlineNotesNepal
- String in PHP || Server Side Scripting || OnlineNotesNepal
- Operators in PHP || Server Side Scripting || OnlineNotesNepal
- PHP Conditional Statements || Server Side Scripting || OnlineNotesNepal
- Types of Loops in PHP || Server Side Scripting || OnlineNotesNepal
- Arrays in PHP || Server Side Scripting || OnlineNotesNepal
- PHP Functions in Sorting Arrays || Server Side Scripting || OnlineNotesNepal
Unit Six: Client Side Scripting (Java Script)
Unit Ten: Electronic Payment
- Introduction to Electronic Payment || Electronic Payment || OnlineNotesNepal
- E-cash || Electronic Payment || OnlineNotesNepal
- Credit Card || Electronic Payment || OnlineNotesNepal
- E-Cheque || Electronic Payment || OnlineNotesNepal
- Gift and Prepaid Card || Electronic Payment || OnlineNotesNepal
- Payer Authentication(3-D Secure) || Electronic Payment || OnlineNotesNepal
Unit Three: Review of HTML Tags
Escape sequences are also useful for situations where you want to use characters that can’t be typed using a keyboard. Here are some other most commonly used escape sequences.
- \n is replaced by the newline character
- \t is replaced by the tab character
- \r is replaced by the carriage-return character
- \b is replaced by the backspace character
- \\ is replaced by a single backslash (\)
Getting the Length of a String
Finding a String Inside Another String
You can use the indexOf() method to find a substring or string within another string. This method returns the index or position of the first occurrence of a specified string within a string.
Similarly, you can use the lastIndexOf() method to get the index or position of the last occurrence of the specified string within a string, like this:
Both of the indexOf(), and the lastIndexOf() methods return -1, if the subtracting is not found.
Searching for a Pattern Inside a String
You can use the search() method to search a particular piece of text or pattern inside a string.
Like indexOf() method the search() method also returns the index of the first match, and returns -1 if no matches were found, but unlike indexOf() method this method can also take a regular expression as its argument to provide advanced search capabilities.
Extracting a Substring from a String
You can use the slice() method to extract a part or substring from a string.
This method takes 2 parameters: start index (index at which to begin extraction), and an optional end index (index before which to end extraction),
like str.slice(startIndex, endIndex).
Extracting a Fixed Number of Characters from a String
If length is 0 or a negative number, an empty string is returned.
Converting a String to Uppercase or Lowercase
You can use the toUpperCase() method to convert a string to uppercase, like this:
Similarly, you can use the toLowerCase() to convert string to lowercase, like this:
Concatenating Two or More Strings
You can concatenate or combine two or more strings using the + and += assignment operators.
Accessing Individual Characters from a String
You can use the charAt() method to access individual character from a string, like str.charAt(index). The index specified should be an integer between 0 and str.length -1. If no index is provided the first character in the string is returned, since the default is o.
Strings can be treated like read-only arrays, and you can access individual characters from a string using square brackets () instead of the charAt() method, as demonstrated in the following example:
Working with Numbers
Extra large numbers can be represented in exponential notation e.g. 6.02e+23 (same as 6.02×10²³).
Numbers can also be represented in hexadecimal notation (base 16). Hexadecimal numbers are prefixed into 0x. They are commonly used to represents colors. For example:
Operating on Numbers and Strings
As you know from the previous chapters, the + operator is used for both addition and concatenation. So, performing mathematical operations on numbers and strings may produce interesting results. The following example will show you what happens when you add numbers and strings:
If you observe the above example carefully, you will find that the result of the last operation is not just a simple string concatenation, because operators with the same precedence are evaluated from left to right. That’s why, since variables x and y both are numbers they are added first then the result is concatenated with the variable z which is a string, hence final result is 30 + “30” = “3030”.
convert numeric strings (i.e. strings containing numeric values) to numbers in all numeric operations, as shown in the following example:
Moreover, if you try to multiply or divide numbers with strings that are not numeric, it returns NaN (Not a Number). Also, if you use mathematical operation, the result will also be NaN.