Search completed in 1.18 seconds.
157 results for "substring":
Your results are loading. Please wait...
String.prototype.substring() - JavaScript
The substring() method returns the part of the string between the start and end indexes, or to the end of the string. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.substring(indexStart[, indexEnd]) Parameters indexStart The index of the first character to include in the returned substring. indexEnd Optional The index of the first character to exclude from the returned substring. Return value A new string containing the specified part of the given string. Description substring() extracts characters from indexStart up to but not including indexEnd. In particular: If indexEnd is omitted, substri...
...End Optional The index of the first character to exclude from the returned substring. Return value A new string containing the specified part of the given string. Description substring() extracts characters from indexStart up to but not including indexEnd. In particular: If indexEnd is omitted, substring() extracts characters to the end of the string. If indexStart is equal to indexEnd, substring() returns an empty string. If indexStart is greater than indexEnd, then the effect of substring() is as if the two arguments were swapped; See example below. Any argument value that is less than 0 or greater than stringName.length is treated as if it were 0 and stringName.length, respectively. ...
...l to indexEnd, substring() returns an empty string. If indexStart is greater than indexEnd, then the effect of substring() is as if the two arguments were swapped; See example below. Any argument value that is less than 0 or greater than stringName.length is treated as if it were 0 and stringName.length, respectively. Any argument value that is NaN is treated as if it were 0. ...
...And 14 more matches
nsDependentCSubstring
Class Declaration nsTDependentSubstring_CharT A string class which wraps an external array of string characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_CharT A string class which wraps an external array of string characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_CharT A string class which wraps an external array of string characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
...And 11 more matches
nsDependentSubstring
Class Declaration nsTDependentSubstring_CharT A string class which wraps an external array of string characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_CharT A string class which wraps an external array of string characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_CharT A string class which wraps an external array of string characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
...And 11 more matches
nsDependentSubstring external
Class Declaration substrings Method Overview Constructors Rebind BeginReading EndReading CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate StripChars StripWhitespace Trim DefaultComparator Compare(const PRUnichar*, PRInt32 (*) Compare(const nsAString&, PRInt32 (*) Equals(const PRUnichar*, PRInt32 (*) Equals(const nsAString&, PRInt32 (*) operator< operator<= ...
...ing&, PRInt32 (*) Find(const nsAString&, PRUint32, PRInt32 (*) Find RFind(const nsAString&, PRInt32 (*) RFind(const nsAString&, PRInt32, PRInt32 (*) RFind FindChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...t32 (*) Find RFind(const nsAString&, PRInt32 (*) RFind(const nsAString&, PRInt32, PRInt32 (*) RFind FindChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...And 2 more matches
nsDependentCSubstring external
Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind FindChar RFindChar AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. ...
...= operator== operator>= operator> operator!= EqualsLiteral Find RFind FindChar RFindChar AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. ...
...r RFindChar AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. ...
... void nsDependentCSubstring_external() - source void nsDependentCSubstring_external(const char*, PRUint32) - source Parameters char* aStart PRUint32 aLength void nsDependentCSubstring_external(const nsACString&, PRUint32) - source Parameters nsACString& aStr PRUint32 aStartPos void nsDependentCSubstring_external(const nsACString&, PRUint32, PRUint32) - source Parameters nsACString& aStr PRUint32 aStartPos PRUint32 aLength Rebind void Rebind(const char*, PRUint32) - source Parameters char* aStart PRUint32 aLength BeginReading PRUint32 BeginReading(const char**, const char**) const - source...
substring - XPath
If omitted, the returned string will contain every character from thestart position to the end ofstring. Returns A string. Notes As in other XPath functions, the position is not zero-based. ...
...If omitted, the returned string will contain every character from thestart position to the end ofstring. Returns A string. Notes As in other XPath functions, the position is not zero-based. ...
...If omitted, the returned string will contain every character from thestart position to the end ofstring. Returns A string. Notes As in other XPath functions, the position is not zero-based. ...
substring-after - XPath
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The substring-after function returns a string that is the rest of a given string after a given substring. Syntax substring-after(haystack ,needle ) Arguments haystack The string to be evaluated. Part of this string will be returned. needle The substring to search for. Everything after the first occurrence ofneedle inhaystack will be returned. Returns A string. Examples XPath Example Output substring-after('aa-bb','-') bb substring-after('aa-bb','a') a-bb substring-after('aa-bb','b') b substring-after('aa-bb','q') (empty string) Defined XPath 1.0 4.2 Gecko support Supported. ...
substring-before - XPath
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The substring-before function returns a string that is the part of a given string before a given substring. Syntax substring-before(haystack ,needle ) Arguments haystack The string to be evaluated. Part of this string will be returned. needle The substring to search for. Everything before the first occurrence ofneedle inhaystack will be returned. Returns A string. Examples XPath Example Output substring-before('aa-bb','-') aa substring-before('aa-bb','a') (empty string) substring-before('aa-bb','b') aa- substring-before('aa-bb','q') (empty string) Defined XPath 1.0 4.2 Gecko support Supported. ...
nsPromiseFlatString
Class Declaration Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const char LowerCaseEqualsLiteral(char Assign ...
...teral(const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes nsString Data Members No public members. ...
... operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes nsString Data Members No public members. ...
...And 13 more matches
nsString
or narrow characters This class is also known as nsAFlat[C]String, where "flat" is used to denote a null-terminated string. ...
...ar Base Classes nsAString_internal Data Members No public members. ...
... Data Members No public members. ...
...And 13 more matches
nsAutoString
antly smaller or any larger than 64 characters. ...
... source constructors void nsAutoString(PRUnichar) - source Parameters PRUnichar c void nsAutoString(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void nsAutoString(const nsAutoString&) - source Parameters nsAutoString& str void nsAutoString(const nsAString_internal&) - source Parameters nsAString_internal& str void nsAutoString(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple operator= nsAutoString& operator=(const nsAutoString&) - source Parameters nsAutoString& str nsString& operator=(const nsString&) - source Parameters nsString& str nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* d...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where...
...And 12 more matches
nsCAutoString
characters Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar ...
...s void nsCAutoString(char) - source Parameters char c void nsCAutoString(const char*, PRUint32) - source Parameters char* data PRUint32 length void nsCAutoString(const nsCAutoString&) - source Parameters nsCAutoString& str void nsCAutoString(const nsACString_internal&) - source Parameters nsACString_internal& str void nsCAutoString(const nsCSubstringTuple&) - source Parameters nsCSubstringTuple& tuple operator= nsCAutoString& operator=(const nsCAutoString&) - source Parameters nsCAutoString& str nsCString& operator=(const nsCString&) - source Parameters nsCString& str nsACString_internal& operator=(char) - source Parameters char c nsACString_internal& operator=(const char*) - source ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tell...
...And 12 more matches
nsCString
aracters This class is also known as nsAFlat[C]String, where "flat" is used to denote a null-terminated string. ...
... StripChar Base Classes nsACString_internal Data Members No public members. ...
..._internal Data Members No public members. ...
...And 12 more matches
nsPromiseFlatCString
Class Declaration Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const char LowerCaseEqualsLiteral(char ...
...const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes nsCString Data Members No public members. ...
...tor+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes nsCString Data Members No public members. ...
...And 12 more matches
NS_ConvertASCIItoUTF16
Class Declaration Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const char LowerCaseEqualsLiteral(char Assign ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param ...
...And 11 more matches
NS_ConvertUTF8toUTF16
Class Declaration Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const char LowerCaseEqualsLiteral(char Assign ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param ...
...And 11 more matches
nsDependentCString
a nsTDependentString continues to reference valid memory for the duration of its use. ...
...d to measure the length. Parameters char* data A pointer to the string. Must not be null. nsDependentCString(const nsCString_internal&, PRUint32) Constructs an nsDependentString from an existing flat string. Parameters nsCString_internal& str The existing flat string. PRUint32 startPos The position within the existing string at which the dependent string should start. This is similar to using Substring(str, startPos), except that the resulting string is flat. void nsDependentCString() - source Constructs an nsDependentString to be rebound later. nsDependentCString(const nsACString_internal&) - source Obsolete in Gecko 9. This constructor should not be used. Parameters nsACString_internal& str AssertValid void AssertValid() - source verify restrictions Rebind void Rebind(const char...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in ...
...And 11 more matches
nsDependentString
ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param ...
...And 11 more matches
nsFixedString
Class Declaration Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const char LowerCaseEqualsLiteral(char Assign ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param ...
...And 11 more matches
nsXPIDLString
NAMES: nsXPIDLString for wide characters nsXPIDLCString for narrow characters Method Overview Constructors operator const PRUnichar* operator[] operator= get Find RFind RFindChar FindCharInSet RFindCharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param ...
...And 11 more matches
Useful string methods - Learn web development
st letter of a series of strings and order them alphabetically. To retrieve the last character of any string, we could use the following line, combining this technique with the length property we looked at above: browserType[browserType.length-1]; The length of "mozilla" is 7, but because the count starts at 0, the character position is 6; using length-1 gets us the last character. ...
...ning this technique with the length property we looked at above: browserType[browserType.length-1]; The length of "mozilla" is 7, but because the count starts at 0, the character position is 6; using length-1 gets us the last character. Finding a substring inside a string and extracting it Sometimes you'll want to find if a smaller string is present inside a larger one (we generally say if a substring is present inside a string). This can be done using the indexOf() method, which takes a single parameter -- the substring you want to search for. ...
...0, the character position is 6; using length-1 gets us the last character. Finding a substring inside a string and extracting it Sometimes you'll want to find if a smaller string is present inside a larger one (we generally say if a substring is present inside a string). This can be done using the indexOf() method, which takes a single parameter -- the substring you want to search for. If the substring is found inside the main string, it returns a number representing the index position of the substring -- which character number of the main string the substring starts at. If the substring is not found inside the main string, it returns a value of -1. ...
...And 10 more matches
NS_ConvertUTF16toUTF8
Class Declaration A helper class that converts a UTF-16 string to UTF-8 Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqual...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param aCo...
...And 10 more matches
NS_LossyConvertUTF16toASCII
Class Declaration A helper class that converts a UTF-16 string to ASCII in a lossy manner Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param aCo...
...And 10 more matches
nsAdoptingString
its value. Note that this class violates constness in a few places. ...
...& str nsString& operator=(const nsString&) - source Parameters nsString& str nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data nsAString_internal& operator=(const nsAString_internal&) - source Parameters nsAString_internal& str nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple operator const PRUnichar* PRUnichar* operator const PRUnichar*() const - source operator[] PRUnichar operator[](PRInt32) const - source Parameters PRInt32 i PRUnichar operator[](PRUint32) const - source Parameters PRUint32 i get PRUnichar* get() const - source returns the null-terminated string Find PRInt3...
...Use -1 to search the whole string. @return offset in string, or kNotFound Parameters nsCString& aString PRBool aIgnoreCase PRInt32 aOffset PRInt32...
...And 10 more matches
nsFixedCString
Class Declaration Method Overview Constructors operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt operator[] First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const char LowerCaseEqualsLiteral(char ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param aCo...
...And 10 more matches
nsXPIDLCString
: nsXPIDLString for wide characters nsXPIDLCString for narrow characters Method Overview Constructors operator const char* operator[] operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated CharAt First Last CountChar FindChar Equals EqualsASCII EqualsLiteral(const char EqualsLiteral(char LowerCaseEqualsASCII ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in ...
... @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param aCo...
...And 10 more matches
nsACString_internal
Class Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES: nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="456,5,605,53" href="http://developer.mozilla.org/en/nsACString_internal" shape="rect" title="nsACString_internal"> <area alt="" coords="415,101,497,149" href="http://developer.mozilla.org/en/nsCString" shape="rect" title="nsCString"> <area alt="" coords="521,101,689,149" href="http://developer.mozilla.org/en/nsDepe...
...ed as an optimization. ...
...me="classes"> <area alt="" coords="456,5,605,53" href="http://developer.mozilla.org/en/nsACString_internal" shape="rect" title="nsACString_internal"> <area alt="" coords="415,101,497,149" href="http://developer.mozilla.org/en/nsCString" shape="rect" title="nsCString"> <area alt="" coords="521,101,689,149" href="http://developer.mozilla.org/en/nsDependentCSubstring" shape="rect" title="nsDependentCSubstring"> <area alt="" coords="172,197,289,245" href="http://developer.mozilla.org/en/nsFixedCString" shape="rect" title="nsFixedCString"> <area alt="" coords="315,197,437,245" href="http://developer.mozilla.org/en/nsXPIDLCString" shape="rect" title="nsXPIDLCString"> <area alt="" coords="461,197,611,245" href="http://developer.mozilla.org/en/nsDependentCString" shape="rect" title="nsDependentCString"> <a...
...And 9 more matches
nsAString_internal
Class Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES: nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="415,5,553,53" href="http://developer.mozilla.org/en/nsAString_internal" shape="rect" title="nsAString_internal"> <area alt="" coords="379,101,451,149" href="http://developer.mozilla.org/en/nsString" shape="rect" title="nsString"> <area alt="" coords="475,101,635,149" href="http://developer.mozilla.org/en/nsDependen...
...inlined as an optimization. ...
...es" name="classes"> <area alt="" coords="415,5,553,53" href="http://developer.mozilla.org/en/nsAString_internal" shape="rect" title="nsAString_internal"> <area alt="" coords="379,101,451,149" href="http://developer.mozilla.org/en/nsString" shape="rect" title="nsString"> <area alt="" coords="475,101,635,149" href="http://developer.mozilla.org/en/nsDependentSubstring" shape="rect" title="nsDependentSubstring"> <area alt="" coords="151,197,257,245" href="http://developer.mozilla.org/en/nsFixedString" shape="rect" title="nsFixedString"> <area alt="" coords="284,197,396,245" href="http://developer.mozilla.org/en/nsXPIDLString" shape="rect" title="nsXPIDLString"> <area alt="" coords="420,197,559,245" href="http://developer.mozilla.org/en/nsDependentString" shape="rect" title="nsDependentString"> <area al...
...And 9 more matches
nsAdoptingCString
ue. Note that this class violates constness in a few places. ...
...IDLCString& str nsCString& operator=(const nsCString&) - source Parameters nsCString& str nsACString_internal& operator=(char) - source Parameters char c nsACString_internal& operator=(const char*) - source Parameters char* data nsACString_internal& operator=(const nsACString_internal&) - source Parameters nsACString_internal& str nsACString_internal& operator=(const nsCSubstringTuple&) - source Parameters nsCSubstringTuple& tuple operator const char* char* operator const char*() const - source operator[] char operator[](PRInt32) const - source Parameters PRInt32 i char operator[](PRUint32) const - source Parameters PRUint32 i get char* get() const - source returns the null-terminated string Find PRInt32 Find(const nsCString&, PRBo...
...Use -1 to search the whole string. @return offset in string, or kNotFound Parameters nsCString& aString PRBool aIgnoreCase PRInt32 aOffset PRInt32...
...And 9 more matches
Mozilla internal string guide
torage within an auto string's stack buffer Auto strings will prefer reference counting an existing reference-counted buffer over their stack buffer, but will otherwise use their stack buffer for anything that will fit in it. There are a number of additional string classes: Classes which exist primarily as constructors for the other types, particularly nsDependent[C]String and nsDependent[C]Substring. These types are really just convenient notation for constructing an ns[C]S[ubs]tring with a non-default ownership mode; they should not be thought of as different types. nsLiteral[C]String which should rarely be constructed explicitly but usually through the ""_ns and u""_ns user-defined string literals. nsLiteral[C]String is trivially constructible and destructible, and therefore does not emit...
...typedefs for nsAutoStringN<64> and nsAutoCStringN<64>, respectively.) nsDependentString- derived from nsString, this string does not own its buffer. It is useful for converting a raw string (const char16_t* or const char*) into a class of type nsAString. Note that you must null-terminate buffers used by to nsDependentString. If you don't want to or can't null-terminate the buffer, use nsDependentSubstring. nsPrintfCString- derived from nsCString, this string behaves like an nsAutoCString. The constructor takes parameters which allows it to construct a 8-bit string from a printf-style format string and parameter list. There are also a number of concrete classes that are created as a side-effect of helper routines, etc. You should avoid direct use of these classes. Let the string library create t...
...ived from nsCString, this string behaves like an nsAutoCString. The constructor takes parameters which allows it to construct a 8-bit string from a printf-style format string and parameter list. There are also a number of concrete classes that are created as a side-effect of helper routines, etc. You should avoid direct use of these classes. Let the string library create the class for you. nsSubstringTuple - created via string concatenation nsDependentSubstring - created through Substring nsPromiseFlatString - created through PromiseFlatString() nsLiteral[C]String - created through the ""_ns and u""_ns user-defined literals Of course, there are times when it is necessary to reference these string classes in your code, but as a general rule they should be avoided. Iterators Because Mozil...
...And 8 more matches
IAccessibleText
1.0 66 Introduced Gecko 1.9 Inherits from: IUnknown Last changed in Gecko 1.9 (Firefox 3) This enum defines values which specify a text() boundary type. IA2_TEXT_BOUNDARY_SENTENCE is optional. When a method doesn't implement this method it must return S_FALSE. Typically this feature would not be implemented by an application. ...
...cters([out] long nCharacters ); [propget] HRESULT newText([out] IA2TextSegment newText ); [propget] HRESULT nSelections([out] long nSelections ); [propget] HRESULT offsetAtPoint([in] long x, [in] long y, [in] enum IA2CoordinateType coordType, [out] long offset ); [propget] HRESULT oldText([out] IA2TextSegment oldText ); HRESULT removeSelection([in] long selectionIndex ); HRESULT scrollSubstringTo([in] long startIndex, [in] long endIndex, [in] enum IA2ScrollType scrollType ); HRESULT scrollSubstringToPoint([in] long startIndex, [in] long endIndex, [in] enum IA2CoordinateType coordinateType, [in] long x, [in] long y ); [propget] HRESULT selection([in] long selectionIndex, [out] long startOffset, [out] long endOffset ); HRESULT setCaretOffset([in] long offset ); HRESULT setSelectio...
...ite. Return value E_INVALIDARG if bad [in] passed, [out] values are 0s and null respectively. S_FALSE if there is nothing to return, [out] values are 0s and null respectively. S_OK. caretOffset() Returns the position of the caret. Returns the 0-based offset of the caret within the text(). If the text() is implemented as a tree of text() objects with embed characters in higher levels representing substrings of child text() objects and the caret is in one of the child text() objects, then the offset in the higher level text() object would be at the embed character representing child text() object that contains the caret. For example, if the string "one two three" is implemented as a two text() objects, with a top level text() object containing an embed character "one ? three" and a child text() obje...
...And 8 more matches
HTML text fundamentals - Learn web development
ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
...ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
...ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
...And 2 more matches
Index
Mozilla › Tech › XPCOM › Index
rigin: 165 IAccessibleEditableText Interfaces, XPCOM, XPCOM Interface Reference This interface is typically used in conjunction with the IAccessibleText interface and complements that interface with the additional capability of clipboard operations. Note that even a read only text object can support the copy capability so this interface is not limited to editable objects. The substrings used with this interface are specified as follows: If startOffset is less than endOffset, the substring starts with the character at startOffset and ends with the character just before endOffset. If endOffset is lower than startOffset, the result is the same as a call with the two arguments exchanged. The whole text can be defined by passing the indices zero and IAccessibleText.nCharacters(). If...
... empty string is defined. Refer to the @ref _specialOffsets "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" for information about a special offset constant that can be used in IAccessibleEditableText methods. 166 IAccessibleHyperlink Interfaces, XPCOM, XPCOM Interface Reference This interface represents a hyperlink associated with a single substring of text or single non-text object. Non-text objects can have either a single link or a collection of links such as when the non-text object is an image map. Linked objects and anchors are implementation dependent. This interface is derived from IAccessibleAction. IAccessibleAction.nActions() is one greater than the maximum value for the indices used with the methods of this interface. Furthermore...
... 333 nsIApplicationCacheNamespace App Cache, Interfaces, Interfaces:Scriptable, Mozilla, Offline, XPCOM, XPCOM Interface Reference, nsIAplicationCacheNamespace, resources Application caches can store a set of namespace entries that affect loads from the application cache. If a load from the cache fails to match on an exact cache entry, the namespace entries are searched for a substring match. 334 nsIApplicationCacheService DOM, Interfaces, Interfaces:Scriptable, Offline_resources, XPCOM, XPCOM Interface Reference Flags the specified key as one that should be cached opportunistically. 335 nsIApplicationUpdateService Interfaces, Interfaces:Scriptable, Update Service, XPCOM, XPCOM API Reference, XPCOM Interface Reference Adds a listener th...
...And 2 more matches
HTMLTextAreaElement - Web APIs
e="Send" /></p> </fieldset> </form> Insert HTML tags example Insert some HTML tags or smiles or any custom text in a textarea. ...
... example Insert some HTML tags or smiles or any custom text in a textarea. ...
...a textarea. ...
...And 2 more matches
Regular expressions - JavaScript
are constructed of characters for which you want to find a direct match. For example, the pattern /abc/ matches character combinations in strings only when the exact sequence "abc" occurs (all characters together and in that order). Such a match would succeed in the strings "Hi, do you know your abc's?" and "The latest airplane designs evolved from slabcraft." In both cases the match is with the substring "abc". There is no match in the string "Grab crab" because while it contains the substring "ab c", it does not contain the exact substring "abc". Using special characters When the search for a match requires something more than a direct match, such as finding one or more b's, or finding white space, you can include special characters in the pattern. For example, to match a single "a" followed b...
... match requires something more than a direct match, such as finding one or more b's, or finding white space, you can include special characters in the pattern. For example, to match a single "a" followed by zero or more "b"s followed by "c", you'd use the pattern /ab*c/: the * after "b" means "0 or more occurrences of the preceding item." In the string "cbbabbbbcdebc", this pattern will match the substring "abbbbc". The following pages provide lists of the different special characters that fit into each category, along with descriptions and examples. Assertions Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). Character...
...ion or flag that performs a global search, looking in the whole string and returning all matches. It is explained in detail below in Advanced Searching With Flags. Why isn't this built into JavaScript? There is a proposal to add such a function to RegExp, but it was rejected by TC39. Using parentheses Parentheses around any part of the regular expression pattern causes that part of the matched substring to be remembered. Once remembered, the substring can be recalled for other use. See Groups and ranges for more details. Using regular expressions in JavaScript Regular expressions are used with the RegExp methods test() and exec() and with the String methods match(), replace(), search(), and split(). These methods are explained in detail in the JavaScript reference. Methods that use regular ...
...And 2 more matches
nsIAccessibleText
If set < 0 then c...
...If set < 0 then caret will be placed at the end of the text. characterCount long Read only. defaultTextAttr...
...ethod might return UTF-16 strings, or it could return "string" values which are UTF-8. AString getTextBeforeOffset( in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset ); Parameters offset boundaryType startOffset endOffset Return value removeSelection() void removeSelection( in long selectionNum ); Parameters selectionNum scrollSubstringTo() Makes a specific part of string visible on screen. void scrollSubstringTo( in long startIndex, in long endIndex, in unsigned long scrollType ); Parameters startIndex 0-based character offset. endIndex 0-based character offset - the offset of the character just past the last character of the string. scrollType Defines how to scroll (see nsIAccessibleScrollType.Constants for available c...
...ific part of string visible on screen. void scrollSubstringTo( in long startIndex, in long endIndex, in unsigned long scrollType ); Parameters startIndex 0-based character offset. endIndex 0-based character offset - the offset of the character just past the last character of the string. scrollType Defines how to scroll (see nsIAccessibleScrollType.Constants for available constants) scrollSubstringToPoint() Moves the top left of a substring to a specified location. void scrollSubstringToPoint( in long startIndex, in long endIndex, in unsigned long coordinateType, in long x, in long y ); Parameters startIndex 0-based character offset. endIndex 0-based character offset - the offset of the character just past the last character of the string. coordinateType Specifies the coordinate...
Text formatting - JavaScript
kets may have undesirable consequences such as the formation of strings with unmatched surrogate code units, in violation of the Unicode standard. (Examples should be added to this page after MDN bug 857438 is fixed.) See also String.fromCodePoint() or String.prototype.codePointAt(). ...
... startsWith, endsWith, includes Returns whether or not the string starts, ends or contains a specified string. concat Combines the text of two strings and returns a new string. ...
... startsWith, endsWith, includes Returns whether or not the string starts, ends or contains a specified string. concat Combines the text of two strings and returns a new string. fromCharCode, fromCodePoint Constructs a string from the specified sequence of Unicode values. This is a method of the String class, not a String instance. ...
...t the string starts, ends or contains a specified string. concat Combines the text of two strings and returns a new string. fromCharCode, fromCodePoint Constructs a string from the specified sequence of Unicode values. This is a method of the String class, not a String instance. split Splits a String object into an array of strings by separating the string into substrings. slice Extracts a section of a string and returns a new string. substring, substr Return the specified subset of the string, either by specifying the start and end indexes or the start index and a length. match, matchAll, replace, replaceAll, search Work with regular expressions. toLowerCase, toUpperCase Return the string in all lowercase or a...
String.prototype.replace() - JavaScript
ion) Parameters regexp (pattern) A RegExp object or literal. The match or matches are replaced with newSubstr or the value returned by the specified function. substr A String that is to be replaced by newSubstr. It is treated as a literal string and is not interpreted as a regular expression. Only the first occurrence will be replaced. newSubstr (replacement) The String that replaces the substring specified by the specified regexp or substr parameter. A number of special replacement patterns are supported; see the "Specifying a string as a parameter" section below. function (replacement) A function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. The arguments supplied to this function are described in the "Specifying a function a...
...cription This method does not change the calling String object. It simply returns a new string. To perform a global search and replace, include the g switch in the regular expression. Specifying a string as a parameter The replacement string can include the following special replacement patterns: Pattern Inserts $$ Inserts a "$". $& Inserts the matched substring. $` Inserts the portion of the string that precedes the matched substring. $' Inserts the portion of the string that follows the matched substring. $n Where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. Note that this is 1-indexed. If a group n is not present (e.g., if grou...
...e) will be used as the replacement string. (Note: The above-mentioned special replacement patterns do not apply in this case.) Note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is global. The arguments to the function are as follows: Possible name Supplied value match The matched substring. ...
... match The matched substring. (Corresponds to $& above.) p1, p2, ... The nth string found by a parenthesized capture group (including named capturing groups), provided the first argument to replace() was a RegExp object. (Corresponds to $1, $2, etc. above.) For example, if /(\a+)(\b+)/, was given, p1 is the match for \a+, and p2 for \b+. offset The offset of the matched substring within the whole string being examined. (For example, if the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string The whole string being examined. groups In browser versions supporting named capturing groups, will be an object whose keys are the used group names, and whose values are the matched portions (undefined if not match...
String.prototype.replaceAll() - JavaScript
flag. The matches are replaced with newSubstr or the value returned by the specified function. A RegExp without the global ("g") flag will throw a TypeError: "replaceAll must be called with a global RegExp". substr A String that is to be replaced by newSubstr. It is treated as a literal string and is not interpreted as a regular expression. newSubstr (replacement) The String that replaces the substring specified by the specified regexp or substr parameter. A number of special replacement patterns are supported; see the "Specifying a string as a parameter" section below. function (replacement) A function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. The arguments supplied to this function are described in the "Specifying a function a...
...Return value A new string, with all matches of a pattern replaced by a replacement. Description This method does not change the calling String object. It simply returns a new string. Specifying a string as a parameter The replacement string can include the following special replacement patterns: Pattern Inserts $$ Inserts a "$". $& Inserts the matched substring. $` Inserts the portion of the string that precedes the matched substring. $' Inserts the portion of the string that follows the matched substring. $n Where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. Note that this is 1-indexed. Specifying a function as a paramete...
...e) will be used as the replacement string. (Note: The above-mentioned special replacement patterns do not apply in this case.) Note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is global. The arguments to the function are as follows: Possible name Supplied value match The matched substring. (Corresponds to $& above.) p1, p2, ... The nth string found by a parenthesized capture group, provided the first argument to replace() was a RegExp object. (Corresponds to $1, $2, etc. above.) For example, if /(\a+)(\b+)/, was given, p1 is the match for \a+, and p2 for \b+. offset The offset of the matched substring within the whole string being examined. (For example, if...
...... The nth string found by a parenthesized capture group, provided the first argument to replace() was a RegExp object. (Corresponds to $1, $2, etc. above.) For example, if /(\a+)(\b+)/, was given, p1 is the match for \a+, and p2 for \b+. offset The offset of the matched substring within the whole string being examined. (For example, if the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string The whole string being examined. (The exact number of arguments depends on whether the first argument is a RegExp object--and, if so, how many parenthesized submatches it specifies.) Examples Using replaceAll 'aabbcc'.replaceAll('b', '.'); // 'aa..cc' Non-global regex throws When using a regular expression search value, it mu...
xml:base support in old browsers - Archive of obsolete content
(scheme)) { // Only check for XML Base if there is no protocol // tests for 'scheme' per http://www.ietf.org/rfc/rfc2396.txt' xmlbase = getXmlBase (thisitem); if (!xmlbase.match(/\/$/) && !xlink.match(/\/$/)) { // If no preceding slash on XLink or trailing slash on xml:base, add one in between xmlbase += '/'; } else if (xmlbase.match(/\/$/) && xlink.match(/\/$/)) { xmlbase = xmlbase.substring(0, xmlbase.length-2); // Strip off last slash to join with XLink path with slash } // alert(xmlbase + '::' + xlink); } var link = xmlbase + xlink; if (!link.match(scheme)) { // If there is no domain, we'll need to use the current domain var loc = window.location; if (link.indexOf('/') === 0 ) { // If link is an absolute URL, it should be from the host only link...
... // var ns = 'http://www.w3.org/XML/1998/namespace'; var att, protocolPos; var xmlbase = ''; var abs ...
...Match = att.match(scheme); if (protocolMatch) { // if has protocol, can stop if (abs) { var skipfile = (att.indexOf('///') === protocolPos) ? ...
String Quick Reference - Archive of obsolete content
passing strings across function boundaries Why: using abstract classes allows the caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments. ...
...Why: Avoid copying and conversion from literal char-based strings to UTF16 strings. ...
...nch of nsAutoStrings, and use Left(), Right() and Mid() to grab a segment of a string: // get an 8-character string starting at the 4th position nsAutoString leftside; str.Left(leftside, 12); nsAutoString middle; leftside.Right(middle, 8); New way: use Substring() to grab a direct reference to those characters: // get an 8-character string starting at the 4th position const nsAString& middle = Substring(str, 4, 8); Unicode literals What: Use macro tricks to make wide-character literal strings. Why: Avoid copying and conversion from literal char-based strings to UTF16 strings. Old way: use nsAutoString and AssignWithConversion() nsAutoString wideString; wideString.AssignWithConversion("some string"); CallWideFunction(wideString); // use wideString again, but need a const PRUnichar* CallWid...
Advanced text formatting - Learn web development
tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.on...
... tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.on...
... tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.on...
Getting started with HTML - Learn web development
ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
...ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
...ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
Arrays - Learn web development
n strings and arrays Often you'll be presented with some raw data contained in a big long string, and you might want to separate the useful items out into a more useful form and then do things to them, like display them in a data table. To do this, we can use the split() method. In its simplest form, this takes a single parameter, the character you want to separate the string at, and returns the substrings between the separator as items in an array. Note: Okay, this is technically a string method, not an array method, but we've put it in with arrays as it goes well here. Let's play with this, to see how it works. First, create a string in your console: let myData = 'Manchester,London,Liverpool,Birmingham,Leeds,Carlisle'; Now let's split it at each comma: let myArray = myData.split(','...
... tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
...y tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
nsIAccessibleScrollType
accessible/public/nsIAccessibleTypes.idlScriptable These constants control the scrolling of an object or substring into a window. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Constants Constant Value Description SCROLL_TYPE_TOP_LEFT 0x00 Scroll the top left of the object or substring to the top left of the window (or as close as possible). SCROLL_TYPE_BOTTOM_RIGHT 0x01 Scroll the bottom right of the object or substring to the bottom right of the window (or as close as possible). ...
...o 1.9 (Firefox 3) Constants Constant Value Description SCROLL_TYPE_TOP_LEFT 0x00 Scroll the top left of the object or substring to the top left of the window (or as close as possible). SCROLL_TYPE_BOTTOM_RIGHT 0x01 Scroll the bottom right of the object or substring to the bottom right of the window (or as close as possible). SCROLL_TYPE_TOP_EDGE 0x02 Scroll the top edge of the object or substring to the top edge of the window (or as close as possible). SCROLL_TYPE_BOTTOM_EDGE 0x03 Scroll the bottom edge of the object or substring to the bottom edge of the window (or as close as possible). SCROLL_TYPE_LEFT_EDGE 0x04 Scroll the left edge of the object or substring to the left edge of the window (or as close as possible). SCROLL_TYPE_RIGHT_EDGE 0x05 Scroll the right edge of the object ...
... the top edge of the window (or as close as possible). SCROLL_TYPE_BOTTOM_EDGE 0x03 Scroll the bottom edge of the object or substring to the bottom edge of the window (or as close as possible). SCROLL_TYPE_LEFT_EDGE 0x04 Scroll the left edge of the object or substring to the left edge of the window (or as close as possible). SCROLL_TYPE_RIGHT_EDGE 0x05 Scroll the right edge of the object or substring to the right edge of the window (or as close as possible). SCROLL_TYPE_ANYWHERE 0x06 Scroll an object the minimum amount necessary in order for the entire frame to be visible (if possible). ...
Regular expression syntax cheatsheet - JavaScript
as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). String.match() won't return groups if the /.../g flag is set. However, you can still use String.matchAll() to get all matches. \n Where "n" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, /apple(,)\so...
... For example, /(?<title>\w+), yes \k<title>/ matches "Sir, yes Sir" in "Do you copy? Sir, yes Sir!". ...
...operty of the returned matches under the name specified by <Name>. The angle brackets (< and >) are required for group name. For example, to extract the United States area code from a phone number, we could use /\((?<area>\d\d\d)\)/. The resulting number would appear under matches.groups.area. (?:x) Non-capturing group: Matches "x" but does not remember the match. The matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Quantifiers If you are looking to contribute to this document, please also edit the original article Note: In the following, item refers not only to singular characters, but also includes character classes, Unicode property escapes, groups and ranges. ...
Groups and ranges - JavaScript
as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). String.match() won't return groups if the /.../g flag is set. However, you can still use String.matchAll() to get all matches. \n Where "n" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, /apple(,)\so...
... For example, /(?<title>\w+), yes \k<title>/ matches "Sir, yes Sir" in "Do you copy? Sir, yes Sir!". ...
...operty of the returned matches under the name specified by <Name>. The angle brackets (< and >) are required for group name. For example, to extract the United States area code from a phone number, we could use /\((?<area>\d\d\d)\)/. The resulting number would appear under matches.groups.area. (?:x) Non-capturing group: Matches "x" but does not remember the match. The matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Examples Counting vowels var aliceExcerpt = "There was a long silence after this, and Alice could only hear whispers now and then."; var regexpVowels = /[aeiouy]/g; console.log("Number of vowels:", aliceExcerpt.match(regexpVowels).length); // Number of ...
TypeError: "x" is (not) "y" - JavaScript
is not an object TypeError: "x" is not an object or null TypeError: "x" is not a symbol Error type TypeError. What went wrong? There was an unexpected type. This occurs oftentimes with undefined or null values. Also, certain methods, such as Object.create() or Symbol.keyFor(), require a specific type, that must be provided. ...
...null TypeError: "x" is not a symbol Error type TypeError. What went wrong? There was an unexpected type. This occurs oftentimes with undefined or null values. Also, certain methods, such as Object.create() or Symbol.keyFor(), require a specific type, that must be provided. ...
... went wrong? There was an unexpected type. This occurs oftentimes with undefined or null values. Also, certain methods, such as Object.create() or Symbol.keyFor(), require a specific type, that must be provided. Examples Invalid cases // undefined and null cases on which the substring method won't work var foo = undefined; foo.substring(1); // TypeError: foo is undefined var foo = null; foo.substring(1); // TypeError: foo is null // Certain methods might require a specific type var foo = {} Symbol.keyFor(foo); // TypeError: foo is not a symbol var foo = 'bar' Object.create(foo); // TypeError: "foo" is not an object or null Fixing the issue To fix null pointer to undefined values, you can use the typeof operator, for example. if (foo !== undefined) { // Now we know that foo is defined...
Intl.Locale.prototype.baseName - JavaScript
baseName returns the language ["-" script] ["-" region] *("-" variant) subsequence of the unicode_language_id grammar. ...
... baseName returns the language ["-" script] ["-" region] *("-" variant) subsequence of the unicode_language_id grammar. ...
... baseName returns the language ["-" script] ["-" region] *("-" variant) subsequence of the unicode_language_id grammar. ...
RegExp.prototype.exec() - JavaScript
result[1] === "Brown" result[2] === "Jumps" index The 0-based index of the match in the string. 4 input The original string that was matched against. "The Quick Brown Fox Jumps Over The Lazy Dog" re lastIndex The index at which to s...
...t result = re.exec('The Quick Brown Fox Jumps Over The Lazy Dog'); The following table shows the results for this script: Object Property/Index Description Example result [0] The full string of characters matched "Quick Brown Fox Jumps" [1], ...[n] The parenthesized substring matches, if any. The number of possible parenthesized substrings is unlimited. result[1] === "Brown" result[2] === "Jumps" index The 0-based index of the match in the string. 4 input The original string that was matched against. "The Quick Brown Fox Jumps Over The Lazy Dog" re lastIndex The index at which to start the next match. If g is absent, this will always be 0. ...
...true multiline Indicates if the m flag was used to search across multiple lines. false source The text of the pattern. "quick\s(brown).+?(jumps)" Examples Finding successive matches If your regular expression uses the "g" flag, you can use the exec() method multiple times to find successive matches in the same string. When you do so, the search starts at the substring of str specified by the regular expression's lastIndex property (test() will also advance the lastIndex property). Note that the lastIndex property will not be reset when searching a different string, it will start its search at its existing lastIndex . For example, assume you have this script: let myRe = /ab*/g; let str = 'abbcdefabh'; let myArray; while ((myArray = myRe.exec(str)) !== null) ...
String.prototype.substr() - JavaScript
xtending for a given number of characters afterwards. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.substr(start[, length]) Parameters start The index of the first character to include in the returned substring. length Optional. The number of characters to extract. Return value A new string containing the specified part of the given string. Description substr() extracts length characters from a str, counting from the start index. If start is a positive number, the index starts counting at the start of the string. Its value is capped at str.length. If start is a negative number, the index star...
...) extracts characters to the end of the string. If length is a negative number, it is treated as 0. For both start and length, NaN is treated as 0. Polyfill Microsoft's JScript does not support negative values for the start index. ...
...umber, it is treated as 0. For both start and length, NaN is treated as 0. Polyfill Microsoft's JScript does not support negative values for the start index. ...
String - JavaScript
The String object is used to represent and manipulate a sequence of characters. Description Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their length, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexOf() method, or extracting substrings with the substring() method. Creating strings Strings can be created as primitives, from string literals, or as objects, using the String() constructor: const string1 = "A string primitive"; const string2 = 'Also a string primitive'; const string3 = `Yet another string primitive`; const string4 = new String("A String object"); String primitives and string objects can be used interchangeab...
..., and replaceWith may be a string or function. String.prototype.search(regexp) Search for a match between a regular expression regexp and the calling string. String.prototype.slice(beginIndex[, endIndex]) Extracts a section of a string and returns a new string. ...
... String.prototype.toLocaleLowerCase( [locale, ...locales]) The characters within a string are converted to lowercase while respecting the current locale. ...
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
mented. Various presentation attributes don't work (alignment-baseline, baseline-shift, dominant-baseline, kerning, letter-spacing, word-spacing, writing-mode, glyph-orientation-horizontal, glyph-orientation-vertical) Recently implemented presentation attributes: direction, unicode-bidi, font-variant, text-decoration SVGTextElement Recently imlemented bindings: selectSubString Recently implemented attributes: textLength, lengthAdjust tspan Implemented. Various presentation attributes don't work (alignment-baseline, baseline-shift, dominant-baseline, kerning, letter-spacing, word-spacing, writing-mode, glyph-orientation-horizontal, glyph-orientation-vertical) Recently implemented presentation attributes: di...
...nted. ...
... altGlyphDef Not implemented. altGlyphItem Not implemented. glyphRef Not implemented. ...
context-menu - Archive of obsolete content
Item class constructor, which conveniently maps to the value attribute of the underlying xul element. So if data consists of unique prefix and the desired tooltip text, it is just a matter of kicking in the right moment. ...
... Parameters options : object Required options: Name Type label string The item's label. It must either be a string or an object that implements toString(). Optional options: Name Type image ...
Miscellaneous - Archive of obsolete content
ocusInput(focusEvent) { focusedControl = focusEvent.originalTarget; } function onBlurInput(blurEvent) { focusedControl = null; } or var element = document.commandDispatcher.focusedElement; Inserting text at the cursor function insertText(element, snippet) { var selectionEnd = element.selectionStart + snippet.length; var currentValue = element.value; var beforeText = currentValue.substring(0, element.selectionStart); var afterText = currentValue.substring(element.selectionEnd, currentValue.length); element.value = beforeText + snippet + afterText; element.focus(); //put the cursor after the inserted text element.setSelectionRange(selectionEnd, selectionEnd); } insertText(document.getElementById("example"), "the text to be inserted"); Disabling JavaScript programmatic...
....init(input); var certfile=scriptableStream.read(input.available()); scriptableStream.close(); input.close(); var beginCert = "-----BEGIN CERTIFICATE-----"; var endCert = "-----END CERTIFICATE-----"; certfile = certfile.replace(/[\r\n]/g, ""); var begin = certfile.indexOf(beginCert); var end = certfile.indexOf(endCert); var cert = certfile.substring(begin + beginCert.length, end); certDB.addCertFromBase64(cert, CertTrust, ""); }, classDescription: "Certificate Service", contractID: "@mozilla.org/certs-service;2", classID: Components.ID("{e9d2d37c-bf25-4e37-82a1-16b8fa089939}"), QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), _xpcom_categories: [{ category: "app-startup", service: true ...
Images in HTML - Learn web development
ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
...ab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { var scrollPos = textarea.scrollTop; var caretPos = textarea.selectionStart; var front = (textarea.value).substring(0, caretPos); var back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.onke...
Looping code - Learn web development
y tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
...y tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
Making decisions in your code — conditionals - Learn web development
y tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
...y tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
Solve common problems in your JavaScript code - Learn web development
s equal to another). ...
... Arrays How do you create an array? ...
Gecko info for Windows accessibility vendors
xt nodes must be leaf nodes, so there is no need to check for this interface if the current node has any MSAA or DOM children. Text nodes always support ISimpleDOMNode as well as ISimpleDOMText. ...
...eDOMText: // Includes all DOM whitespace; IAccessible::get_accName does not HRESULT get_domText(BSTR *domText); // Bounding rect clipped to window HRESULT get_clippedSubstringBounds( [in] unsigned int startIndex, [in] unsigned int endIndex, [out] int *x, [out] int *y, [out] int *width, [out] int *height); // Bounding rect unclipped HRESULT get_unclippedSubstringBounds( [in] unsigned int startIndex, [in] unsigned int endIndex, [out] int *x, [out] int *y, [out] int *width, [out] int *height); // Scroll to this part of the subsstring HRESULT scrollToSubstring( [in] unsigned int startIndex, [in] unsigned int endIndex); // Get the current font being used -- this is better than using // the ISimpleDOMNode CSS...
JS_NewDependentString
start, size_t length); Name Type Description cx JSContext * The context in which to create the new string. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JS::HandleString The string containing the characters for the new string. start size_t The start index of the substring. length size_t Length of the substring, in characters. Description JS_NewDependentString creates a new string as a substring of an existing JavaScript string, str. The new string contains the same characters as if it were created with the JavaScript method str.substr(start, length). The characters are not copied. Instead, the new string shares str's existing character storage...
...Otherwise it returns NULL. ...
IAccessibleHyperlink
Non-text objects can have either a single link or a collection of links such as when the non-text object is an image map. Linked objects and anchors are implementation dependent. ...
...[propget] HRESULT anchor( [in] long index, [out] VARIANT anchor ); Parameters index A 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object. The valid maximal index is indicated by IAccessibleAction.nActions(). anchor This is an implementation dependent value. For example, for a text link this method could return the substring of the containing string where the substring is overridden with link behavior, and for an image link this method could return an IUnknown VARIANT for IAccessibleImage. See the section about. Return value E_INVALIDARG if bad [in] passed, [out] value is null. S_FALSE if there is nothing to return, [out] value is null. S_OK. anchorTarget() Returns an object representing the target of the link, as a...
CSSStyleSheet.insertRule() - Web APIs
ewCharCode === 125)) { // 125 = "}".charCodeAt(0) closeBracketPos = i; } isEscaped ^= newCharCode===92?1:isEscaped; // 92 = "\\".charCodeAt(0) } if (closeBracketPos === -1) break a; // No closing bracket was found! ...
...etPos = i; } isEscaped ^= newCharCode===92?1:isEscaped; // 92 = "\\".charCodeAt(0) } if (closeBracketPos === -1) break a; // No closing bracket was found! ...
GlobalEventHandlers.onerror - Web APIs
in some browsers using the crossorigin attribute on <script> and having the server send the appropriate CORS HTTP response headers. A workaround is to isolate "Script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via JavaScript. ...
...on <script> and having the server send the appropriate CORS HTTP response headers. A workaround is to isolate "Script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via JavaScript. ...
Capabilities, constraints, and settings - Web APIs
lement.srcObject to null. Simple tab support in the editor This code adds simple support for tabs to the <textarea> elements by making the tab key insert two space characters when either constraint edit box is focused. ...
... the editor This code adds simple support for tabs to the <textarea> elements by making the tab key insert two space characters when either constraint edit box is focused. ...
SVGTextContentElement - Web APIs
ts parent, SVGGraphicsElement. SVGTextContentElement.getNumberOfChars() Returns a long representing the total number of addressable characters available for rendering within the current element, regardless of whether they will be rendered. SVGTextContentElement.getComputedTextLength() Returns a float representing the computed length for the text within the element. SVGTextContentElement.getSubStringLength() Returns a float representing the computed length of the formatted text advance distance for a substring of text within the element. Note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the CSS 'letter-spacing' and 'word-spacing' properties. Visual spacing adjustments made by the 'x' attribute is ignored. SVGTextContentElemen...
...enting the rotation of typographic character. SVGTextContentElement.getCharNumAtPosition() Returns a long representing the character which caused a text glyph to be rendered at a given position in the coordinate system. Because the relationship between characters and glyphs is not one-to-one, only the first character of the relevant typographic character is returned SVGTextContentElement.selectSubString() Selects text within the element. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGTextContentElement' in that specification. Candidate Recommendation Changed inheritance from SVGElement to SVGGraphicsElement and getStartPositionOfChar() and removed implementations of SVGTests, SVGLangSpace, SVGExternalResources...
SubtleCrypto.importKey() - Web APIs
private key, to use for RSA-PSS signing. Takes a string containing the PEM encoded key, and returns a Promise that will resolve to a CryptoKey representing the private key. ...
...1TkCf4ZQoz96RFPUGPPLOfvN0x66CM1PQCkdhzjE6U5XGE964ZkkYUPPsy6Dcie4obhW4vDjgUmLzv0z7UD010RLIneUgDE2FqBfY/C+uWigNPBPkkQ+Bv/UigS6dHqTCVeD5wgyBQIDAQAB -----END PUBLIC KEY-----`; function importRsaKey(pem) { // fetch the part of the PEM string between header and footer const pemHeader = "-----BEGIN PUBLIC KEY-----"; const pemFooter = "-----END PUBLIC KEY-----"; const pemContents = pem.substring(pemHeader.length, pem.length - pemFooter.length); // base64 decode the string to get the binary data const binaryDerString = window.atob(pemContents); // convert from a binary string to an ArrayBuffer const binaryDer = str2ab(binaryDerString); return window.crypto.subtle.importKey( "spki", binaryDer, { name: "RSA-OAEP", hash: "SHA-256" ...
Deprecated and obsolete features - JavaScript
features These deprecated features can still be used, but should be used with caution because they are expected to be removed entirely sometime in the future. You should work to remove their use from your code. RegExp properties the following properties are deprecated. This does not affect their use in replacement strings: Property Description $1-$9 Parenthesized substring matches, if any. Warning: Using these properties can result in problems, since browser extensions can modify them. Avoid them! $_ See input. $* See multiline. $& See lastMatch. $+ See lastParen. $` See leftContext. $' See rightContext. input The string against which a regular expression is matched. ...
...er extensions can modify them. Avoid them! $_ See input. $* See multiline. $& See lastMatch. $+ See lastParen. $` See leftContext. $' See rightContext. input The string against which a regular expression is matched. lastMatch The last matched characters. lastParen The last parenthesized substring match, if any. leftContext The substring preceding the most recent match. rightContext The substring following the most recent match. The following are now properties of RegExp instances, no longer of the RegExp object: Property Description global Whether or not to test the regular expression against all possible matches in a string, or only...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
Warning: String.slice is deprecated; use String.prototype.slice instead Warning: String.split is deprecated; use String.prototype.split instead Warning: String.startsWith is deprecated; use String.prototype.startsWith instead Warning: String.substr is deprecated; use String.prototype.substr instead Warning: String.substring is deprecated; use String.prototype.substring instead Warning: String.toLocaleLowerCase is deprecated; use String.prototype.toLocaleLowerCase instead Warning: String.toLocaleUpperCase is deprecated; use String.prototype.toLocaleUpperCase instead Warning: String.toLowerCase is deprecated; use String.prototype.toLowerCase instead Warning: String.toUpperCase is depr...
...nt // (one may use shims for these if not available) (function() { 'use strict'; var i, // We could also build the array of methods with the following, but the // getOwnPropertyNames() method is non-shimable: // Object.getOwnPropertyNames(String).filter(function(methodName) { // return typeof String[methodName] === 'function'; // }); methods = [ 'contains', 'substring', 'toLowerCase', 'toUpperCase', 'charAt', 'charCodeAt', 'indexOf', 'lastIndexOf', 'startsWith', 'endsWith', 'trim', 'trimLeft', 'trimRight', 'toLocaleLowerCase', 'normalize', 'toLocaleUpperCase', 'localeCompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localeCompare' ], methodCount = methods.length, assignStringGeneric = function(me...
String.prototype.split() - JavaScript
The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.split([separator[, limit]]) Parameters separator Optional The pattern describing where each split should occur. The separator can be a simple string or it can be a regular expression. ...
...e array at all. The array may contain fewer entries than limit if the end of the string is reached before the limit is reached. If limit is 1, str.split(separator)[0] is returned If limit is 0, [] is returned. Return value An Array of strings, split at each point where the separator occurs in the given string. Description When found, separator is removed from the string, and the substrings are returned in an array. If separator is a regular expression with capturing parentheses, then each time separator matches, the results (including any undefined results) of the capturing parentheses are spliced into the output array. If the separator is an array, then that Array is coerced to a String and used as a separator. Examples Using split() When the string is empty, split() return...
Index - XPath
Web › XPath › Index
The starts-with checks whether the first string starts with the second string and returns true or false. 45 string XSLT, XSLT_Reference The string function converts the given argument to a string. 46 string-length XSLT, XSLT_Reference The string-length function returns a number equal to the number of characters in a given string. ...
...t string starts with the second string and returns true or false. 45 string XSLT, XSLT_Reference The string function converts the given argument to a string. 46 string-length XSLT, XSLT_Reference The string-length function returns a number equal to the number of characters in a given string. 47 substring XSLT, XSLT_Reference The substring function returns a part of a given string. 48 substring-after XSLT, XSLT_Reference The substring-after function returns a string that is the rest of a given string after a given substring. 49 substring-before XSLT, XSLT_Reference The substring-before function returns a string that is the part of a given string before a given substring. 50 sum...
lang/type - Archive of obsolete content
{ isNumber } = require('sdk/lang/type'); isNumber(3.1415); // true isNumber(100); // true isNumber('100'); // false Parameters value : mixed The variable to check. Returns boolean : Boolean indicating if value is a Number. isRegExp(value) Returns true if value is a RegExp, false otherwise. let { isRegExp } = require('sdk/lang/type'); isRegExp(/[^\.]*\.js$/); // true isRegExp(new RegExp('substring')); // true isRegExp(1000); // false Parameters value : mixed The variable to check. Returns boolean : Boolean indicating if value is a RegExp. isDate(value) Returns true if value is a Date, false otherwise. let { isDate } = require('sdk/lang/type'); isDate(new Date()); // true isDate('3/1/2013'); // false Parameters value : mixed The variable to check. Returns boolean : Boolean ind...
StringView - Archive of obsolete content
nUint24 |= aBytes[nIdx] << (16 >>> nMod3 & 24); if (nMod3 === 2 || aBytes.length - nIdx === 1) { sB64Enc += String.fromCharCode(StringView.uint6ToB64(nUint24 >>> 18 & 63), StringView.uint6ToB64(nUint24 >>> 12 & 63), StringView.uint6ToB64(nUint24 >>> 6 & 63), StringView.uint6ToB64(nUint24 & 63)); nUint24 = 0; } } return eqLen === 0 ? sB64Enc : sB64Enc.substring(0, sB64Enc.length - eqLen) + (eqLen === 1 ? "=" : "=="); }; StringView.base64ToBytes = function (sBase64, nBlockBytes) { var sB64Enc = sBase64.replace(/[^A-Za-z0-9\+\/]/g, ""), nInLen = sB64Enc.length, nOutLen = nBlockBytes ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockBytes) * nBlockBytes : nInLen * 3 + 1 >>> 2, aBytes = new Uint8Array(nOutLen); for (var nMod3, nMod4, nUint24 = 0,...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
if (myString.Equals(otherString, nsCaseInsensitiveStringComparator())) + if (myString.Equals(otherString, CaseInsensitiveCompare)) return NS_OK; // woot, we're equal in all things but case When using unicharutils from frozen-linkage code, link against the unicharutil_external_s static library. The frozen string API doesn't implement the Left(), Mid(), or Right() signatures. Use StringHead(), Substring(), and StringTail() instead: nsString buffer = someString; - nsCAutoString prefix;- buffer.Left(prefix, 4); + const nsDependentSubstring prefix = StringHead(buffer, 4); The frozen string API doesn't use nsSubstringTuple objects and maintains all strings in a contiguous buffer. This means that the + operator is not implemented, nor are the PromiseFlatString functions or classes around any more.
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
nd memory. Overriding/Extending/Amending existing functions A common thing add-ons do during their initialization is overriding/extending existing browser functions by using Function.toString/Function.toSource and eval to "string-patch" the function body. // DO NOT USE! var functionBody = gBrowser.addTab.toSource(); var afterBracket = functionBody.indexOf("{") + 1; functionBody = functionBody.substring(0, afterBracket) + "myAddon.onAddTab(aURI);" + functionBody.substring(afterBracket); eval("gBrowser.addTab = " + functionBody); Of course, this not only looks messy, but can be quite error prone. Other extensions might do something similar, trying to hook the same functions, but a little different, ending up with completely broken code. The code is hard to read and by that hard to maintain ...
CSS3 - Archive of obsolete content
in a production environment anymore. CSS Namespaces Module Recommendation since September 29th, 2011 Adds the support for the XML Namespaces by defining the notion of CSS qualified name, using the ' | ' syntax and adding the @namespace CSS at-rule. Selectors Level 3 Recommendation since September 29th, 2011 Adds: Substring matching attribute selectors, E[attribute^="value"], E[attribute$="value"], E[attribute*="value"] . New pseudo-classes: :target, :enabled and :disabled, :checked, :indeterminate, :root, :nth-child and :nth-last-child, :nth-of-type and :nth-last-of-type, :last-child, :first-of-type and :last-of-type, :only-child and :only-of-type,:empty, and :not. Pseudo-elements are now characterized by...
jspage - Archive of obsolete content
Native({name:h,initialize:a[h],protect:true}); }var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var f={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]}; for(var e in f){for(var b=f[e].length;b--;){Native.genericize(a[e],f[e][b],true);}}})();var Hash=new Native({name:"Hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getClean()); }for(var b in a){this[b]=a[b];}return this;}});Hash.implement({forEach:function(b,c){for(var a in this){if(this.hasOwnProperty(a)){b.call(c,this[a],a,this); }}},getCle...
New Security Model for Web Services - Archive of obsolete content
Restriction By restricting sandboxed scripts to access only resources in the domain from which they were loaded, any script loaded from one domain into another is prevented from accessing resources in the domain into which it has been loaded. This policy has generally been successful in sandboxing Javascript and Java applets across the web. If the sandbox is unable to distinguish the common URI substring of the domain to be trusted from similar URIs of untrusted domains, then it could allow a script loaded from an indistinguishable domain to exploit firewall-protected resources. Also, this technique prevents the script from accessing many legitimate external resources not provided in the same domain as the script. This prevents a script from accessing web services and data published from any dom...
String Rosetta Stone - Archive of obsolete content
Find a substring nsString FindInReadable(const nsAString& pattern, nsAString::const_iterator start, nsAString::const_iterator end, nsStringComparator& aComparator = nsDefaultStringComparator()) std::string size_type find(const basic_string& s, size_type pos = 0) const size_type find(const charT* s, size_type pos, size_type n) const size_type find(const charT* s, size_type pos = 0) const size_type find(charT c, size_type pos = 0) const QString int QString::indexOf ( const QString & str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive ) const Format a printf style string nsString AppendPrintf() std::string n/a QString QString & QString::sprintf ( const char * cformat, ... ) ...
The new nsString class implementation (1999) - Archive of obsolete content
static void Insert(nsStrImpl& aDest,PRUint32 aDestOffset, const nsStrImpl& aSource,PRUint32 aSrcOffset,PRInt32 aCount); static void InsertCString(nsStrImpl& aDest,PRUint32 aDestOffset, const char* aSource,PRUint32 aSrcOffset,PRInt32 aCount); static void InsertChar(nsStrImpl& aDest,PRUint32 aDestOffset,char theCha...
rel - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › rel
The numeric value of the subject must be greater than the value before The string value of subject must come before value alphabetically after The string value of subject must come after value alphabetically startswith The value of subject must start with the value endswith The value of subject must end with the value contains The value of subject must contain the value as a substring ...
Multiple Rules - Archive of obsolete content
with one rule, positive values with another greaterMatch if a number is greater than anotherDisplay values greater than 1000 differently beforeMatch if a value comes before another alphabetically afterMatch if a value comes after another alphabetically startswithMatch if a value starts with a specific string endswithMatch if a value ends with a specific string containsMatch if a value contains a substringTo highlight results that contain a search term Here is an example using the 'contains' operator: <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"> <assign var="?letters" expr="string-length(@name) - 1"/> </query> <rule> <where subject="?name" rel="contains" value=" "/> <action> <label uri="?" value="?name has two nam...
Focus and Selection - Archive of obsolete content
f the text. tbox.setSelectionRange(0,0); You can retrieve the current selection by using the selectionStart and selectionEnd properties. These properties are set to the starting and ending positions of the current selection respectively. If both are set to the same value no text is selected, and the cursor is moved to that position. Once you have the start and end positions, you can pull out the substring from the whole text. You can retrieve and modify the contents of the textbox by using the value property. One additional useful property of textboxes is the textLength property, which holds the total number of characters in the field. Next, we'll find out how to use commands. << PreviousNext >> ...
where - Archive of obsolete content
Archive › Mozilla › XUL › where
value Type: string The value to compare. Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, ma...
Browser Detection and Cross Browser Support - Archive of obsolete content
eated as value out of 100. // e.g. ...
New in JavaScript 1.2 - Archive of obsolete content
totype.sort() now works on all platforms. It no longer converts undefined elements to null and sorts them to the high end of the array. String.prototype.split() It can take a regular expression argument, as well as a fixed string, by which to split the object string. It can take a limit count so that it won't include trailing empty elements in the resulting array. String.prototype.substring(): no longer swaps index numbers when the first index is greater than the second. toString(): now converts the object or array to a literal. The break and continue statements can now be used with the new labeled statement. ...
Attribute selectors - Learn web development
s all of the list items except the first one. li[class="a"] matches a selector with a class of a, but not a selector with a class of a with another space-separated class as part of the value. It selects the second list item. li[class~="a"] will match a class of a but also a value that contains the class of a as part of a whitespace-separated list. It selects the second and third list items. Substring matching selectors These selectors allow for more advanced matching of substrings inside the value of your attribute. For example, if you had classes of box-warning and box-error and wanted to match everything that started with the string "box-", you could use [class^="box-"] to select them both (or [class|="box"] as described in section above). Selector Example Description ...
Adding vector graphics to the Web - Learn web development
y tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.o...
From object to iframe — other embedding technologies - Learn web development
tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.blur(); } }; function insertAtCaret(text) { const scrollPos = textarea.scrollTop; const caretPos = textarea.selectionStart; const front = (textarea.value).substring(0, caretPos); const back = (textarea.value).substring(textarea.selectionEnd, textarea.value.length); textarea.value = front + text + back; caretPos = caretPos + text.length; textarea.selectionStart = caretPos; textarea.selectionEnd = caretPos; textarea.focus(); textarea.scrollTop = scrollPos; } // Update the saved userCode every time the user updates the text area code textarea.on...
Functions — reusable blocks of code - Learn web development
, which it needs to do its job properly. Note: Parameters are sometimes called arguments, properties, or even attributes. As an example, the browser's built-in Math.random() function doesn't require any parameters. When called, it always returns a random number between 0 and 1: let myNumber = Math.random(); The browser's built-in string replace() function however needs two parameters -- the substring to find in the main string, and the substring to replace that string with: let myText = 'I am a string'; let newString = myText.replace('string', 'sausage'); Note: When you need to specify multiple parameters, they are separated by commas. It should also be noted that sometimes parameters are optional -- you don't have to specify them. If you don't, the function will generally adopt some kin...
Function return values - Learn web development
You've already met return values a number of times, although you may not have thought about them explicitly. Let's return to a familiar example (from a previous article in this series): let myText = 'The weather is cold'; let newString = myText.replace('cold', 'warm'); console.log(newString); // Should print "The weather is warm" // the replace() string function takes a string, // replaces one substring with another, and returns // a new string with the replacement made The replace() function is invoked on the myText string, and is passed two parameters: the substring to find ('cold'). the string to replace it with ('warm'). When the function completes (finishes running), it returns a value, which is a new string with the replacement made. In the code above, the result of this return valu...
Silly story generator - Learn web development
m. There is a particular string method that will help you here -- in each case, make the call to the method equal to newStory, so each time it is called, newStory is made equal to itself, but with substitutions made. So each time the button is pressed, these placeholders are each replaced with a random silly string. As a further hint, the method in question only replaces the first instance of the substring it finds, so you might need to make one of the calls twice. Inside the first if block, add another string replacement method call to replace the name 'Bob' found in the newStory string with the name variable. In this block we are saying "If a value has been entered into the customName text input, replace Bob in the story with that custom name." Inside the second if block, we are checking to see...
Test your skills: Strings - Learn web development
ariable called finalQuote. You'll find that you get an error at this point. Can you fix the problem with quoteStart, so that the full quote displays correctly? Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Strings 2 In this task you are provided with two variables, quote and substring, which contain two strings. We would like you to: Retrieve the length of the quote, and store it in a variable called quoteLength. Find the index position where substring appears in quote, and store that value in a variable called index. Use a combination of the variables you have and available string properties/methods to trim down the original quote to "I do not like green eggs and ham.",...
Command line crash course - Learn web development
th the terminal. Simple commands do not carry too much danger, but as you start putting together more complex commands, you need to think carefully about what the command will do, and try testing them out first before you finally run them in the intended directory. Let's say you had 1000 text files in a directory, and you wanted to go through them all and only delete the ones that have a certain substring inside the filename. If you are not careful, then you might end up deleting something important, losing you a load of your work in the process. One good habit to get into is to write your terminal command out inside a text editor, figure out how you think it should look, and then make a backup copy of your directory and try running the command on that first, to test it. Another good tip -- if y...
Accessibility Features in Firefox
to the clipboard. The F7 key toggles this feature on/off. Tabbed browsing helps keyboard users by putting all of the browsed documents in one Firefox application window rather than cluttering the Alt+Tab order which makes keyboard navigation within the entire Windows OS much simpler. Both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. Bookmarks can have a keyword assigned to them which can be typed into the address bar to bring up the bookmark. A "smart keywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. These smart keywords can be setup via the context menu for the search field on the desired web...
CSUN Firefox Materials
o the clipboard. The F7 key toggles this feature on/off. Tabbed browsing helps keyboard users by putting all of the browsed documents in one Firefox application window rather than cluttering the Alt+Tab order which makes keyboard navigation within the entire Windows OS much simpler. Both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. Bookmarks can have a keyword assigned to them which can be typed into the address bar to bring up the bookmark. A "smart keywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. These smart keywords can be setup via the context menu for the search field on the desired we...
sslcrt.html
hes the end of the string [abc] matches one occurrence of a, b, or c. The only character that needs to be escaped in this is ], all others are not special. [a-z] matches any character between a and z [^az] matches any character except a or z ~ followed by another shell expression removes any pattern matching the shell expression from the match list (foo|bar) matches either the substring foo or the substring bar. These can be shell expressions as well. CERT_CheckCertValidTimes Checks whether a specified time is within a certificate's validity period. Syntax #include <cert.h> #include <certt.h> SECCertTimeValidity CERT_CheckCertValidTimes( CERTCertificate *cert, int64 t); Parameters This function has the following parameters: cert ...
Rhino overview
or object literal notation ("[1]" or "{a:1, b:2}" for example). In version 1.3 and greater these functions are ECMA conformant. Array constructor Array(i) for a number argument i constructs an array with a single element equal to i for version 1.2 only. Otherwise the ECMA conformant version is used (an array is constructed with no elements but with length property equal to i). String.prototype.substring For version 1.2 only, the two arguments are not swapped if the first argument is less than the second one. All other versions are ECMA compliant. String.prototype.split For version 1.2 only, split performs the Perl4 special case when given a single space character as an argument (skips leading whitespace, and splits on whitespace). All other versions split on the space character proper as spec...
Index
Creates and returns a new JSObject representing a JavaScript Date object, which is pre-configured using the specified values. 399 JS_NewDateObjectMsec Date, JSAPI, JSAPI Reference, SpiderMonkey The returned JSObject is a standard JavaScript Date. 400 JS_NewDependentString JSAPI Reference, SpiderMonkey JS_NewDependentString creates a new string as a substring of an existing JavaScript string, str. The new string contains the same characters as if it were created with the JavaScript method str.substr(start, length). 401 JS_NewDouble JSAPI Reference, Obsolete, SpiderMonkey JS_NewDouble allocates a copy of the number d on the JavaScript garbage collection heap. This function is not very useful. To convert a jsdouble to a jsval, use J...
Bytecode Descriptions
push a default constructor for a base class. A default constructor behaves like constructor() {}. Implements: ClassDefinitionEvaluation for ClassTail, steps 10.b. and 12-17. The sourceStart/sourceEnd offsets are the start/end offsets of the class definition in the source buffer, used for toString(). They must be valid offsets into the source buffer, measured in code units, such that scriptSource->substring(cx, start, end) is valid. Format: JOF_CLASS_CTOR DerivedConstructor Operands: (uint32_t nameIndex, uint32_t sourceStart, uint32_t sourceEnd) Stack: proto => constructor Create and push a default constructor for a derived class. A default derived-class constructor behaves like constructor(...args) { super(...args); }. Implements: ClassDefinitionEvaluation for ClassTail, steps 10.a. and 12-17. s...
JS_AddArgumentFormatter
k. When called from JS_PushArgumentsVA, the formatter is invoked thus: formatter(cx, "AA...", JS_FALSE, &sp, &ap); where JS_FALSE for fromJS means to wrap the C values at ap according to the format specifier and store them at sp, updating ap and sp appropriately. The "..." after "AA" is the rest of the format string that was passed into JS_{Convert,Push}Arguments{,VA}. The actual format trailing substring used in each Convert or PushArguments call is passed to the formatter, so that one such function may implement several formats, in order to share code. See Also bug 788359 ...
JS_MakeStringImmutable
e string to operate on. s must not be null. Description A string's characters can never be changed, but SpiderMonkey uses two string optimization techniques behind the scenes: A growable string (see JS_NewGrowableString ) has a buffer that the JavaScript engine can reallocate so that concatenating it with another string is much faster. A dependent string (see JS_NewDependentString) is a substring of another (growable, dependent, or immutable) string. In memory it is represented as a pointer to the other string and a pair of integers for the substring's starting point and length, rather than as a separate copy of all the characters. This makes the substring operation, and regular expression matches, faster. In both cases, the JavaScript engine may change the fields of the JSString. These ...
Running Automated JavaScript Tests
will be passed along to the harness. Developers will often want to use the -d option: jstests.py -d PATH_TO_JS_SHELL The -d option skips tests that are marked as randomly failing; random failures are usually just noise when being run for day-to-day developer testing. Another common use case is to run just one test, or all the tests in just one directory: jstests.py PATH_TO_JS_SHELL TEST_PATH_SUBSTRING [ TEST_PATH_SUBSTRING_2 ... ] This runs all the tests whose paths contain TEST_PATH_SUBSTRING. Thus, you can run one test by giving its filename, or any substring that is a substring of that test filename only. You can run all tests in a directory by giving the directory path. You can run three specific tests by giving the three names. Or you can run all but selected tests with the --exclude opt...
Gecko object attributes
<< AT APIs Support Page Introduction You can obtain object attributes by nsIAccessible.getAttributes() method. Object attributes are relevant for the entire subtree of the object they are on, unless they are overridden by a descendent with the same object attribute. This is in contrast to text attributes, which apply only to substrings in a text object. Object Attributes List ARIA attributes All ARIA attributes used on DOM element (i.e., any attribute prefixed by 'aria-') are exposed as object attributes; name is preserved except the 'aria-' prefix is cut. Common attributes class The class name for an element from HTML, XUL, SVG, etc. This is useful for retrieving Microformat semantics for an element. display Similar with display CSS style. Applied to: any visible accessible i...
nsACString (External)
g_(External)"> <area alt="" coords="980,102,1121,150" href="http://developer.mozilla.org/en/nsCStringContainer_(External)" shape="rect" title="nsCStringContainer_(External)"> <area alt="" coords="571,198,707,246" href="http://developer.mozilla.org/en/nsCString_external" shape="rect" title="nsCString_external"> <area alt="" coords="731,198,955,246" href="http://developer.mozilla.org/en/nsDependentCSubstring_external" shape="rect" title="nsDependentCSubstring_external"> <area alt="" coords="979,198,1123,246" href="http://developer.mozilla.org/en/PromiseFlatCString_(External)" shape="rect" title="PromiseFlatCString_(External)"> <area alt="" coords="1147,198,1259,246" href="http://developer.mozilla.org/en/nsCAutoString_(External)" shape="rect" title="nsCAutoString_(External)"> <area alt="" coords="5,29...
nsAString (External)
String_(External)"> <area alt="" coords="939,102,1069,150" href="http://developer.mozilla.org/en/nsStringContainer_(External)" shape="rect" title="nsStringContainer_(External)"> <area alt="" coords="548,198,676,246" href="http://developer.mozilla.org/en/nsString_external" shape="rect" title="nsString_external"> <area alt="" coords="700,198,913,246" href="http://developer.mozilla.org/en/nsDependentSubstring_external" shape="rect" title="nsDependentSubstring_external"> <area alt="" coords="937,198,1071,246" href="http://developer.mozilla.org/en/PromiseFlatString_(External)" shape="rect" title="PromiseFlatString_(External)"> <area alt="" coords="1095,198,1196,246" href="http://developer.mozilla.org/en/nsAutoString_(External)" shape="rect" title="nsAutoString_(External)"> <area alt="" coords="5,294,197...
XPCOM glue classes
lly on destruction of the object.</t>nsCStringClass DeclarationnsCString externalClass DeclarationnsCStringContainer (External)Class Declaration nsCStringEncodingThe nsCStringEncoding enumeration describes the set of character encodings understood by the NS_CStringToUTF16 and NS_UTF16ToCString functions.nsDependentCStringClass DeclarationnsDependentCString externalClass DeclarationnsDependentCSubstringClass DeclarationnsDependentCSubstring externalClass DeclarationnsDependentStringClass DeclarationnsDependentString externalClass DeclarationnsDependentSubstringClass DeclarationnsDependentSubstring externalClass DeclarationnsEmbedCStringThe nsEmbedCString concrete class provides a way to construct a nsACString object that allocates null-terminated storage.nsEmbedStringThe nsEmbedString concrete c...
IAccessibleEditableText
66 Introduced Gecko 1.9 Inherits from: IUnknown Last changed in Gecko 1.9 (Firefox 3) This interface is typically used in conjunction with the IAccessibleText interface and complements that interface with the additional capability of clipboard operations. Note that even a read only text object can support the copy capability so this interface is not limited to editable objects. The substrings used with this interface are specified as follows: If startOffset is less than endOffset, the substring starts with the character at startOffset and ends with the character just before endOffset. If endOffset is lower than startOffset, the result is the same as a call with the two arguments exchanged. The whole text can be defined by passing the indices zero and IAccessibleText.nCharacters(). If...
mozITXTToHTMLConv
s ">". logLineStart On output, this parameter is set to indicate the offset into the string of the first non-cite character. You must set this value to zero before calling this method. Return value The cite level of the quote; that is, the number of text quote characters found at the beginning of the string. findURLInPlaintext() Returns the start and end offsets of the first URL found in a substring. void findURLInPlaintext( in wstring text, in long aLength, in long aPos, out long aStartPos, out long aEndPos ); Parameters text The string to scan for the presence of a URL. aLength The length of the buffer to scan. aPos The character offset into the string at which to begin the scan. aStartPos On return, indicates the offset to the first character of the first found URL,...
nsIApplicationCacheNamespace
ts an application cache namespace. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Application caches can store a set of namespace entries that affect loads from the application cache. If a load from the cache fails to match on an exact cache entry, the namespace entries are searched for a substring match. Method overview void init(in unsigned long itemType, in ACString namespaceSpec, in ACString data); Attributes Attribute Type Description data ACString Data associated with the namespace, such as a fallback. How this attribute is used varies depending on the namespace type. If the data is a URI, this attribute should be the URI's asciiSpec. R...
nsIContentSniffer
Ci.nsIPrefLocalizedString).data; } catch (e) { } let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Ci.nsIScriptableUnicodeConverter); conv.charset = charset; try { let str = conv.convertFromByteArray(aData, aLength); if (str.substring(0, 5) == "%PDF-") return "application/pdf"; // we detected a pdf file } catch (e) { // try to get information from aRequest } ...
nsIURL
If no commonality is found, the entire uri spec is returned. If they are identical, "" is returned. Filename, query, and so forth are always returned except when uris are identical. AUTF8String getRelativeSpec( in nsIURI aURIToCompare ); Parameters aURIToCompare A URI to compare with Return value The common URI portion See also...
NS_CStringContainerInit2
This flag should not be combined with NS_CSTRING_CONTAINER_INIT_ADOPT. NS_CSTRING_CONTAINER_INIT_ADOPT Data passed into NS_CStringContainerInit2 is not copied. Instead, the string takes ownership over the data pointer. The caller must have allocated the data array using the XPCOM memory allocator. This flag should not be combined with NS_CSTRING_CONTAINER_INIT_DEPEND. NS_CSTRING_CONTAINER_INIT_SUBSTRING Data passed into NS_CStringContainerInit2 is a substring that is not null-terminated. Return Values The NS_CStringContainerInit function returns NS_OK if successful. Otherwise, it returns an error code. Remarks After a nsCStringContainer object has been initialized via NS_CStringContainerInit2, it may be used as an ordinary nsACString object. When the string object is no longer needed, it ...
NS_CStringSetDataRange
nto this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_CStringSetDataRange function returns NS_OK if successful. Otherwise, it returns an error code. ...
NS_StringSetDataRange
o this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringSetDataRange function returns NS_OK if successful. Otherwise, it returns an error code. ...
Search - Firefox Developer Tools
Searching for files To search for a particular file, press Control + P (or Command + P on a Mac) and type the search term. The source pane will display a list of all matching files as you type. You can use the up and down arrows to move through the list, and Return to open the file you want: Searching within a file To search for a particular substring in the file currently loaded into the source pane, press Control + F (or Command + F on a Mac) while the source pane is focused. Press Return to search. The debugger will display the number of matches in the code and highlight each result: Using the Outline tab If you are searching for a specific function within the current JavaScript file, you can use the Outline tab in the debugger to find it quickly. The Outline tab lists the functions in...
Debugger.Memory - Firefox Developer Tools
ject to the next. To take advantage of this regularity, SpiderMonkey objects with identical sets of properties may share their property metadata; only property values are stored directly in the object. Array objects may also be optimized, if the set of live indices is dense. Strings SpiderMonkey has three representations of strings: Normal: the string's text is counted in its size. Substring: the string is a substring of some other string, and points to that string for its storage. This representation may result in a small string retaining a very large string. However, the memory consumed by the string itself is a small constant independent of its size, since it is simply a reference to the larger string, a start position, and a length. Concatenations: When asked to concatenate...
Debugger.Source - Firefox Developer Tools
tring, and describe where it came from. Each Debugger.Script instance refers to the Debugger.Source instance holding the source code from which it was produced. If a single piece of source code contains both top-level code and function definitions, perhaps with nested functions, then the Debugger.Script instances for those all refer to the same Debugger.Source instance. Each script indicates the substring of the overall source to which it corresponds. A Debugger.Source instance may represent only a portion of a larger source document. For example, an HTML document can contain JavaScript in multiple <script> elements and event handler content attributes. In this case, there may be either a single Debugger.Source instance for the entire HTML document, with each Debugger.Script referring to its subs...
CharacterData - Web APIs
ed offset, in the CharacterData.data string; when this method returns, data contains the modified DOMString. ChildNode.remove() Removes the object from its parent children list. CharacterData.replaceData() Replaces the specified amount of characters, starting at the specified offset, with the specified DOMString; when this method returns, data contains the modified DOMString. CharacterData.substringData() Returns a DOMString containing the part of CharacterData.data of the specified length and starting at the specified offset. Specifications Specification Status Comment DOMThe definition of 'CharacterData' in that specification. Living Standard Added implemention of the ChildNode and NonDocumentTypeChildNode interface. Document Object Model (DOM) Le...
DocumentOrShadowRoot.activeElement - Web APIs
Text Area Two. Fusce ullamcorper, nisl ac porttitor adipiscing, urna orci egestas libero, ut accumsan orci lacus laoreet diam. ...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
at gives the text of the node.) * * @param txt The text node whose data should be returned * @return A string giving the contents of the text node with * whitespace collapsed. */ function data_of( txt ) { var data = txt.textContent; // Use ECMA-262 Edition 3 String and RegExp features data = data.replace(/[\t\n\r ]+/g, " "); if (data.charAt(0) == " ") data = data.substring(1, data.length); if (data.charAt(data.length - 1) == " ") data = data.substring(0, data.length - 1); return data; } Example The following code demonstrates the use of the functions above. It iterates over the children of an element (whose children are all elements) to find the one whose text is "This is the third paragraph", and then changes the class attribute and the contents of that...
Element: select event - Web APIs
The event is not available for all elements in all languages. For example, in HTML, select events can be dispatched only on form <input type="text"> and <textarea> elements. ...
Using Fetch - Web APIs
startIndex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerDone) { break; } let remainder = chunk.substr(startIndex); ({ value: chunk, done: readerDone } = await reader.read()); chunk = remainder + (chunk ? ...
GlobalEventHandlers.onselect - Web APIs
is a function name or a function expression. The function receives a UIEvent object as its sole argument. Examples This example logs the text you select inside a <textarea> element. HTML <textarea>Try selecting some text in this element.</textarea> <p id="log"></p> JavaScript function logSelection(event) { const log = document.getElementById('log'); const selection = event.target.value.substring(event.target.selectionStart, event.target.selectionEnd); log.textContent = `You selected: ${selection}`; } const textarea = document.querySelector('textarea'); textarea.onselect = logSelection; Result Specification Specification Status Comment HTML Living StandardThe definition of 'onselect' in that specification. Living Standard ...
HTMLImageElement - Web APIs
Element.srcset A USVString reflecting the srcset HTML attribute. This specifies a list of candidate images, separated by commas (',', U+002C COMMA). Each candidate image is a URL followed by a space, followed by a specially-formatted string indicating the size of the image. The size may be specified either the width or a size multiple. Read the srcset page for specifics on the format of the size substring. HTMLImageElement.useMap A DOMString reflecting the usemap HTML attribute, containing the page-local URL of the <map> element describing the image map to use. The page-local URL is a pound (hash) symbol (#) followed by the ID of the <map> element, such as #my-map-element. The <map> in turn contains <area> elements indicating the clickable areas in the image. HTMLImageElement.width An integer ...
ReadableStreamDefaultReader.read() - Web APIs
...
TextEncoder.prototype.encodeInto() - Web APIs
memory usage and speed) threshold t such that if roundUpToBucketSize(s.length) + t >= s.length * 3, you simply allocate for s.length * 3. Otherwise, first allocate for roundUpToBucketSize(s.length) and convert. If the read item it the return dictionary is s.length, the conversion is done. If not, reallocate the target buffer to written + (s.length - read) * 3 and then convert the rest by taking a substring of s starting from index read and a subbuffer of the target buffer starting from index written. Above roundUpToBucketSize() is a function that rounds up to the allocator bucket size. For example, if your Wasm allocator is known to use power-of-two buckets, roundUpToBucketSize() should return the argument if it is a power-of-two or the next power-of-two otherwise. If the behavior of the Wasm allo...
URLSearchParams.get() - Web APIs
ailable in Web Workers. Syntax URLSearchParams.get(name) Parameters name The name of the parameter to return. Return value A USVString if the given search parameter is found; otherwise, null. Examples If the URL of your page is https://example.com/?name=Jonathan&age=18 you could parse out the 'name' and 'age' parameters using: let params = new URLSearchParams(document.location.search.substring(1)); let name = params.get("name"); // is the string "Jonathan" let age = parseInt(params.get("age"), 10); // is the number 18 Requesting a parameter that isn't present in the query string will return null: let address = params.get("address"); // null Specifications Specification Status Comment URLThe definition of 'get()' in that specification. Living Standard...
Architecture - Accessibility
so stop get the offset in the parent text for this object (see B above), and then repeat step (C)2 above done (D) To get the next word or line: Look one character ahead. If the next character does not exist, proceed to the next accessible in depth first search order and recurse on the first character until a non-embed is found. If the current character falls within a text substring, locate the line ending of that substring or the next embed, whichever comes first: Get the current line start and end offsets. Compute the item offset relative to the start of this line Search forward from the starting offset for an embed character If an embed character is found, continue processing with offset = index plus the line start index If an embed char...
regexp:replace() - EXSLT
Web › EXSLT › regexp › replace
en regular expression with the contents of another string. Syntax regexp:replace(originalString, regExpString, flagsString, replaceString) Parameters originalString The string perform a search-and-replace operation upon. regExpString The JavaScript style regular expression to evaluate. flagsString The string containing character flags. replaceString The string with which the matched substrings are to be replaced. The character flags are: g - Global replace If this flag is specified, all occurrences of the regular expression within the originalString are replaced. Otherwise only the first occurrence is replaced. i - Case insensitive match If this flag is specified, the match is performed in a case insensitive fashion. Returns The revised version of the string. Specification...
Writing forward-compatible websites - Developer guides
add features and remove them. They also fix bugs. All three of these have happened in the past and will happen again. So don't sniff for one feature or object and then assume that, because it exists or doesn't exist, some other feature or object must also exist or not exist. Don't UA-sniff This is really a particularly common instance of assuming that one feature (the presence of a particular substring in the user agent (UA) string) implies something about the presence or absence of other features. If you have to UA-sniff, only sniff for past browser versions If you have to resort to UA sniffing, only use it to target past browser versions of particular browsers. First, have a default code path that runs in unknown browsers and in the current and future versions of browsers you are testing wi...
<input type="datetime-local"> - HTML: Hypertext Markup Language
year. <!--midnight of January 1st, 10000: the exact time of Y10K--> <input type="datetime-local" value=""+010000-01-01T05:00"/> It's that simple. Just prepare your code for any number of digits. Do not only prepare for 5 digits. Here is JavaScript code for programmatically setting the value: function setValue(element, date) { var isoString = date.toISOString() element.value = isoString.substring(0, (isoString.indexOf("T")|0) + 6|0); } Why worry about the Y10K problem if it is going to happen many centuries after your death? Exactly because you will already be dead, so the companies using your software will be stuck using your software without any other coder who knows the system well enough to come in and fix it. Examples In this example we create two sets of UI elements for choosing ...
Choosing between www and non-www URLs - HTTP
This domain name is hosted on a server where the document resides. A server isn't necessarily a physical machine: several servers can reside on the same physical machine. Or, one server can be handled by several machines, cooperating to produce the answer or balancing the load of the requests between them. ...
Browser detection using the user agent - HTTP
UA strings are notoriously misleading. It assumed that the lookbehind feature would always be available if the browser was Chrome. The agent might be an older version of Chrome, from before support was added, or (because the feature was experimental at the time) it could be a later version of Chrome that removed it. Most importantly, it assumed no other browsers would sup...
JavaScript data types and data structures - JavaScript
. The first element is at index 0, the next at index 1, and so on. The length of a String is the number of elements in it. Unlike some programming languages (such as C), JavaScript strings are immutable. This means that once a string is created, it is not possible to modify it. However, it is still possible to create another string based on an operation on the original string. For example: A substring of the original by picking individual letters or using String.substr(). A concatenation of two strings using the concatenation operator (+) or String.concat(). Beware of "stringly-typing" your code! It can be tempting to use strings to represent complex data. Doing this comes with short-term benefits: It is easy to build complex strings with concatenation. Strings are easy to debug (what ...
TypeError: can't access property "x" of "y" - JavaScript
amples: TypeError: x is undefined, can't access property "prop" of it TypeError: x is null, can't access property "prop" of it TypeError: can't access property "prop" of undefined TypeError: can't access property "prop" of null Error type TypeError. What went wrong? The property access was operated on undefined or null value. Examples Invalid cases // undefined and null cases on which the substring method won't work var foo = undefined; foo.substring(1); // TypeError: x is undefined, can't access property "substring" of it var foo = null; foo.substring(1); // TypeError: x is null, can't access property "substring" of it Fixing the issue To fix null pointer to undefined or null values, you can use the typeof operator, for example. if (typeof foo !== 'undefined') { // Now we know that ...
ReferenceError: "x" is not defined - JavaScript
here is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope. Note: When loading a library (such as jQuery), make sure it is loaded before you access library variables, such as "$". Put the <script> tag that loads the library before your code that uses it. Examples Variable not declared foo.substring(1); // ReferenceError: foo is not defined The "foo" variable isn't defined anywhere. It needs to be some string, so that the String.prototype.substring() method will work. var foo = 'bar'; foo.substring(1); // "ar" Wrong scope A variable needs to be available in the current context of execution. Variables defined inside a function cannot be accessed from anywhere outside the function, becaus...
Array - JavaScript
roperty/Element Description Example input Read only The original string against which the regular expression was matched. "cdbBdbsbz" index Read only The zero-based index of the match in the string. 1 [0] Read only The last matched characters. "dbBd" [1], ...[n] Read only Elements that specify the parenthesized substring matches (if included) in the regular expression. The number of possible parenthesized substrings is unlimited. [1]: "bB" [2]: "d" Constructor Array() Creates a new Array object. Static properties get Array[@@species] The constructor function is used to create derived objects. Static methods Array.from() Creates a new Array instance from an array-like or iterable obje...
Intl.Locale - JavaScript
les, just as Unicode does. This is a simple and lightweight solution that works well. Adding a Locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags. Constructor Intl.Locale() Creates a new Locale object. Instance properties Intl.Locale.prototype.baseName Returns basic, core information about the Locale in the form of a substring of the complete data string. Intl.Locale.prototype.calendar Returns the part of the Locale that indicates the Locale's calendar era. Intl.Locale.prototype.caseFirst Returns whether case is taken into account for the locale's collation rules. Intl.Locale.prototype.collation Returns the collation type for the Locale, which is used to order strings according to the locale's rules. Intl.Locale...
Intl - JavaScript
le that's at least, but possibly more, suited for the request than the result of the Lookup algorithm. If the application doesn't provide a locales argument, or the runtime doesn't have a locale that matches the request, then the runtime's default locale is used. The matcher can be selected using a property of the options argument (see below). If the selected language tag had a Unicode extension substring, that extension is now used to customize the constructed object or the behavior of the function. Each constructor or function supports only a subset of the keys defined for the Unicode extension, and the supported values often depend on the language tag. For example, the "co" key (collation) is only supported by Collator, and its "phonebk" value is only supported for German. options argument Th...
RegExp.prototype[@@replace]() - JavaScript
e source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax regexp[Symbol.replace](str, newSubStr|function) Parameters str A String that is a target of the replacement. newSubStr (replacement) The String that replaces the substring. A number of special replacement patterns are supported; see the Specifying a string as a parameter section in String.prototype.replace() page. function (replacement) A function to be invoked to create the new substring. The arguments supplied to this function are described in the Specifying a function as a parameter section in String.prototype.replace() page. Return value A new string with ...
RegExp.prototype[@@split]() - JavaScript
The [@@split]() method splits a String object into an array of strings by separating the string into substrings. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax regexp[Symbol.split](str[, limit]) Parameters str The target of the split operation. limit Optional Integer specifying a limit on the number of splits to be found. The [@@split]() method still splits on every match of this RegExp pattern (or, in the Syntax above, regexp), until the number of split items match the limit or the string falls short of this pattern. Return value An Array containing substrings as its elements. Description This m...
RegExp.lastParen ($+) - JavaScript
RegExp.$+ is an alias for this property. Description The lastParen property is static, it is not a property of an individual regular expression object. Instead, you always use it as RegExp.lastParen or RegExp['$+']. The value of the lastParen property is read-only and modified whenever a successful match is made. You can not use the shorthand alias with the dot property accessor (RegExp.$+), because the parser expects an expression with "+" in that case and a SyntaxError is thrown. ...
RegExp.leftContext ($`) - JavaScript
RegExp.$` is an alias for this property. Description The leftContext property is static, it is not a property of an individual regular expression object. Instead, you always use it as RegExp.leftContext or RegExp['$`']. The value of the leftContext property is read-only and modified whenever a successful match is made. You can not use the shorthand alias with the dot property accessor (RegExp.$`), because the parser expects a starting template string in that case and a SyntaxError is thrown. ...
RegExp.$1-$9 - JavaScript
The legacy RegExp $1, $2, $3, $4, $5, $6, $7, $8, $9 properties are static and read-only properties of regular expressions that contain parenthesized substring matches. Description The $1, ..., $9 properties are static, they are not a property of an individual regular expression object. Instead, you always use them as RegExp.$1, ..., RegExp.$9. The values of these properties are read-only and modified whenever successful matches are made. The number of possible parenthesized substrings is unlimited, but the RegExp object can only hold the first nine. You can access all parenthesized substrings through the returned array's indexes. These properties can be used in the replacement text for the String.replace method. When used this way, do not prepend them with RegExp. The example below illustrat...
RegExp.rightContext ($') - JavaScript
RegExp.$' is an alias for this property. Description The rightContext property is static, it is not a property of an individual regular expression object. Instead, you always use it as RegExp.rightContext or RegExp["$'"]. The value of the rightContext property is read-only and modified whenever a successful match is made. You can not use the shorthand alias with the dot property accessor (RegExp.$'), because the parser expects a starting string in that case and a SyntaxError is thrown. ...
RegExp - JavaScript
arameter. RegExp.prototype.toString() Returns a string representing the specified object. Overrides the Object.prototype.toString() method. RegExp.prototype[@@match]() Performs match to given string and returns match result. RegExp.prototype[@@matchAll]() Returns all matches of the regular expression against a string. RegExp.prototype[@@replace]() Replaces matches in given string with new substring. RegExp.prototype[@@search]() Searches the match in given string and returns the index the pattern found in the string. RegExp.prototype[@@split]() Splits given string into an array by separating the string into substrings. Examples Using a regular expression to change data format The following script uses the replace() method of the String instance to match a name in the format first las...
String.prototype.endsWith() - JavaScript
s method has been added to the ECMAScript 6 specification and may not be available in all JavaScript implementations yet. ...
String.prototype.repeat() - JavaScript
t. ...
String.prototype.startsWith() - JavaScript
ed to the ECMAScript 2015 specification and may not be available in all JavaScript implementations yet. However, you can polyfill String.prototype.startsWith() with the following snippet: if (!String.prototype.startsWith) { Object.defineProperty(String.prototype, 'startsWith', { value: function(search, rawPos) { var pos = rawPos > 0 ? rawPos|0 : 0; return this.substring(pos, pos + search.length) === search; } }); } A more robust (fully ES2015 specification compliant), but less performant and compact, Polyfill is available on GitHub by Mathias Bynens. Examples Using startsWith() //startswith let str = 'To be, or not to be, that is the question.' console.log(str.startsWith('To be')) // true console.log(str.startsWith('not to be')) ...
Symbol.replace - JavaScript
This function is called by the String.prototype.replace() method. For more information, see RegExp.prototype[@@replace]() and String.prototype.replace(). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
Symbol - JavaScript
or for an object. Used by for...of. Symbol.match A method that matches against a string, also used to determine if an object may be used as a regular expression. Used by String.prototype.match(). Symbol.matchAll A method that returns an iterator, that yields matches of the regular expression against a string. Used by String.prototype.matchAll(). Symbol.replace A method that replaces matched substrings of a string. Used by String.prototype.replace(). Symbol.search A method that returns the index within a string that matches the regular expression. Used by String.prototype.search(). Symbol.split A method that splits a string at the indices that match a regular expression. Used by String.prototype.split(). Symbol.species A constructor function that is used to create derived objects. Symbo...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
e closed path, effected by the startOffset attribute and text-anchor property Implementation status unknown <tref> removed Implementation status unknown <altGlyph>, <altGlyphDef>, <altGlyphItem> and <glyphRef> removed <altGlyph>, <altGlyphDef> and <altGlyphItem> removed (bug 1260032), <glyphRef> never really implemented (bug 1302693) SVGTextContentElement.selectSubString() deprecated Implementation status unknown getComputedTextLength() not including dx and dy values Implementation status unknown Text in non-rendered elements not included in addressable characters Implementation status unknown Unknown elements in text render as unpositioned spans Implementation status unknown Offset distances of text positioned alon...
contains - XPath
Otherwise, false. Defined XPath 1.0 4.2 Gecko support Supported. ...
Functions - XPath
() contains() count() current() XSLT-specific document() XSLT-specific element-available() false() floor() format-number() XSLT-specific function-available() generate-id() XSLT-specific id() (partially supported) key() XSLT-specific lang() last() local-name() name() namespace-uri() normalize-space() not() number() position() round() starts-with() string() string-length() substring() substring-after() substring-before() sum() system-property() XSLT-specific translate() true() unparsed-entity-url() XSLT-specific (not supported) ...
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
generate-id() (supported) id() (partially supported) key() (supported) lang() (supported) last() (supported) local-name() (supported) name() (supported) namespace-uri() (supported) normalize-space() (supported) not() (supported) number() (supported) position() (supported) round() (supported) starts-with() (supported) string() (supported) string-length() (supported) substring() (supported) substring-after() (supported) substring-before() (supported) sum() (supported) system-property() (supported) translate() (supported) true() (supported) unparsed-entity-url() (not supported) ...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
() (supported) generate-id() (supported) id() (partially supported) key() (supported) lang() (supported) last() (supported) local-name() (supported) name() (supported) namespace-uri() (supported) normalize-space() (supported) not() (supported) number() (supported) position() (supported) round() (supported) starts-with() (supported) string() (supported) string-length() (supported) substring() (supported) substring-after() (supported) substring-before() (supported) sum() (supported) system-property() (supported) translate() (supported) true() (supported) unparsed-entity-url() (not supported) For Further Reading Books Online The World Wide Web Consortium Portals Articles Tutorials/Examples Mailing Lists/Newsgroups Resources Index Original Docum...