The string processing functions of JavaScript native are not rich enough,
Native string function: http://www.jb51.net/w3school/js/jsref_obj_string.htm
Question 1: Is there any extension library for the string type?
Yes, not many, not comprehensive.
Opinion 2: jquery is powerful in Dom operations, so we do not want the JS string extension library to be developed based on jquery. Do you agree?
Question 3: What string extension functions do we need?
For this problem, refer to other JS libraries and string operation functions in other languages.
Extended string type by prototype. JS:
Http://api.prototypejs.org/language/string/
String functions in other languages
C #:Http://msdn.microsoft.com/zh-cn/library/system.string_members (V = vs.80). aspx
Java: Http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html
Python:Http://docs.python.org/library/stdtypes.html#string-methods
Perl:, Perl is a process-orientedProgramming LanguageThere is no concept of a string object. All string-related operation functions are scattered.
Question 4: What programming style is the best for string function extensions?
String. Prototype. Trim = function ()
{
// Use a regular expression to replace spaces with empty strings.
Return this. Replace (/(^ \ s *) | (\ s * $)/g ,"");
}
Question 5: Abstract: Can I think that all operation functions are for string addition, deletion, modification, query, and type conversion?