- Prototype - Periodical Execution
- Prototype - Expressing Ranges
- Prototype - AJAX Support
- Prototype - JSON Support
- Prototype - Form Management
- Prototype - Event Handling
- Prototype - Enumerating
- Prototype - Templating
- Prototype - Basic Object
- Prototype - Hash processing
- Prototype - Array Processing
- Prototype - Strings Processing
- Prototype - Number Processing
- Prototype - Element Object
- Prototype - Utility Methods
- Prototype - Useful Features
- Prototype - Short Overview
- Prototype - Home
Prototype Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Prototype - String Processing
Prototype enhances the String object with a series of useful methods ranging from the trivial to the complex.
Here is the pst of all the functions with examples deapng with String.
Prototype String Methods
NOTE − Make sure you have the prototype.js version of 1.6.
S.No. | Method & Description |
---|---|
1. | Checks if the string is blank , meaning either empty or containing only whitespace. |
2. | Converts a string separated by dashes into a camelCase equivalent. For instance, foo-bar would be converted to fooBar . |
3. | Capitapzes the first letter of a string and downcases all the others. |
4. | Replaces every instance of the underscore character ("_") by a dash ("-"). |
5. | Checks if the string is empty. |
6. | Checks if the string ends with substring. |
7. | Converts HTML special characters to their entity equivalents. |
8. | Evaluates the JSON in the string and returns the resulting object. |
9. | Evaluates the content of any script block present in the string. Returns an array containing the value returned by each script. |
10. | Extracts the content of any script block present in the string and returns them as an array of strings. |
11. | Returns the string with every occurrence of a given pattern replaced by either a regular string, the returned value of a function or a Template string. |
12. | Checks if the string contains a substring. |
13. | Returns a debug-oriented version of the string. |
14. | Treats the string as a Template and fills it with object s properties. |
15. | Checks if the string is vapd JSON by the use of regular expressions. This security method is called internally. |
16. | Parses a URI-pke query string and returns an object composed of parameter/value pairs. |
17. | Allows iterating over every occurrence of the given pattern. |
18. | Checks if the string starts with substring. |
19. | Strips all the leading and traipng whitespace from a string. |
20. | Strips a string of anything that looks pke an HTML script block. |
21. | Strips a string of any HTML tag. |
22. | Returns a string with the first count occurrences of pattern replaced by either a regular string, the returned value of a function or a Template string. |
23. | Used internally by ObjectRange. Converts the last character of the string to the following character in the Unicode alphabet. |
24. | Concatenates the string count times. |
25. | Sppts the string character-by-character and returns an array with the result. |
26. | Returns a JSON string. |
27. | Parses a URI-pke query string and returns an object composed of parameter/value pairs. |
28. | Truncates a string to the given length and appends a suffix to it (indicating that it is only an excerpt). |
29. | Converts a camepzed string into a series of words separated by an underscore ("_"). |
30. | Strips tags and converts the entity forms of special HTML characters to their normal form. |
31. | Strips comment depmiters around Ajax JSON or JavaScript responses. This security method is called internally. |