Mercurial > hg > nginx-site
comparison xml/en/docs/njs/reference.xml @ 2268:cd1b26111884
Moved string.split to follow alphabetical order.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Mon, 29 Oct 2018 21:36:11 +0300 |
parents | c30048802769 |
children | 34a1901e663d |
comparison
equal
deleted
inserted
replaced
2267:c30048802769 | 2268:cd1b26111884 |
---|---|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> | 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
8 | 8 |
9 <article name="Reference" | 9 <article name="Reference" |
10 link="/en/docs/njs/reference.html" | 10 link="/en/docs/njs/reference.html" |
11 lang="en" | 11 lang="en" |
12 rev="13"> | 12 rev="14"> |
13 | 13 |
14 <section id="summary"> | 14 <section id="summary"> |
15 | 15 |
16 <para> | 16 <para> |
17 <link doc="index.xml">njs</link> provides objects, methods and properties | 17 <link doc="index.xml">njs</link> provides objects, methods and properties |
708 >> 'abcdefghijklmno'.slice(NaN, 5) | 708 >> 'abcdefghijklmno'.slice(NaN, 5) |
709 'abcde' | 709 'abcde' |
710 </example> | 710 </example> |
711 </tag-desc> | 711 </tag-desc> |
712 | 712 |
713 <tag-name id="string_startswith"><literal>String.prototype.startsWith(<value>searchString</value>[, | |
714 <value>position</value>])</literal></tag-name> | |
715 <tag-desc> | |
716 Returns <literal>true</literal> if a string begins with the characters | |
717 of a specified string, otherwise <literal>false</literal>. | |
718 The optional <literal>position</literal> parameter is the position | |
719 in this string at which to begin search for <literal>searchString</literal>. | |
720 Default value is 0. | |
721 <example> | |
722 >> 'abc'.startsWith('abc') | |
723 true | |
724 > 'aabc'.startsWith('abc') | |
725 false | |
726 </example> | |
727 </tag-desc> | |
728 | |
729 <tag-name id="string_substr"><literal>String.prototype.substr(<value>start</value>[, | |
730 <value>length</value>])</literal></tag-name> | |
731 <tag-desc> | |
732 Returns the part of the string of the specified <literal>length</literal> | |
733 from <literal>start</literal> | |
734 or from <literal>start</literal> to the end of the string. | |
735 <example> | |
736 >> 'abcdefghijklmno'.substr(3, 5) | |
737 'defgh' | |
738 </example> | |
739 </tag-desc> | |
740 | |
741 <tag-name id="string_substring"><literal>String.prototype.substring(<value>start</value>[, | |
742 <value>end</value>])</literal></tag-name> | |
743 <tag-desc> | |
744 Returns the part of the string between | |
745 <literal>start</literal> and <literal>end</literal> or | |
746 from <literal>start</literal> to the end of the string. | |
747 <example> | |
748 >> 'abcdefghijklmno'.substring(3, 5) | |
749 'de' | |
750 </example> | |
751 </tag-desc> | |
752 | |
753 <tag-name id="string_tobytes"><literal>String.prototype.toBytes(start[, | |
754 end])</literal></tag-name> | |
755 <tag-desc> | |
756 (njs specific) Serializes a Unicode string to a byte string. | |
757 Returns <literal>null</literal> if a character larger than 255 is | |
758 found in the string. | |
759 </tag-desc> | |
760 | |
761 <tag-name id="string_tolowercase"><literal>String.prototype.toLowerCase()</literal></tag-name> | |
762 <tag-desc> | |
763 Converts a string to lower case. | |
764 The method supports only simple Unicode folding. | |
765 <example> | |
766 >> 'ΑΒΓΔ'.toLowerCase() | |
767 'αβγδ' | |
768 </example> | |
769 </tag-desc> | |
770 | |
771 <tag-name><literal>String.prototype.toString([<value>encoding</value>])</literal></tag-name> | |
772 <tag-desc> | |
773 <para> | |
774 If no <literal>encoding</literal> is specified, | |
775 returns a specified Unicode string or byte string as in ECMAScript. | |
776 </para> | |
777 | |
778 <para> | |
779 (njs specific) If <literal>encoding</literal> is specified, | |
780 encodes a <link id="string_tobytes">byte string</link> to | |
781 <literal>hex</literal>, | |
782 <literal>base64</literal>, or | |
783 <literal>base64url</literal>. | |
784 </para> | |
785 <example> | |
786 >> 'αβγδ'.toUTF8().toString('base64url') | |
787 'zrHOss6zzrQ' | |
788 </example> | |
789 </tag-desc> | |
790 | |
791 <tag-name id="string_touppercase"><literal>String.prototype.toUpperCase()</literal></tag-name> | |
792 <tag-desc> | |
793 Converts a string to upper case. | |
794 The method supports only simple Unicode folding. | |
795 <example> | |
796 >> 'αβγδ'.toUpperCase() | |
797 'ΑΒΓΔ' | |
798 </example> | |
799 </tag-desc> | |
800 | |
801 <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>start</value>[, | |
802 <value>end</value>])</literal></tag-name> | |
803 <tag-desc> | |
804 (njs specific) Serializes a Unicode string | |
805 to a byte string using UTF8 encoding. | |
806 <example> | |
807 >> 'αβγδ'.toUTF8().length | |
808 8 | |
809 >> 'αβγδ'.length | |
810 4 | |
811 </example> | |
812 </tag-desc> | |
813 | |
814 <tag-name id="string_trim"><literal>String.prototype.trim()</literal></tag-name> | |
815 <tag-desc> | |
816 Removes whitespaces from both ends of a string. | |
817 <example> | |
818 >> ' abc '.trim() | |
819 'abc' | |
820 </example> | |
821 </tag-desc> | |
822 | |
823 <tag-name id="string_split"><literal>String.prototype.split(([<value>string</value>|<value>regexp</value>[, | 713 <tag-name id="string_split"><literal>String.prototype.split(([<value>string</value>|<value>regexp</value>[, |
824 <value>limit</value>]]))</literal></tag-name> | 714 <value>limit</value>]]))</literal></tag-name> |
825 <tag-desc> | 715 <tag-desc> |
826 Returns match of a string against a <literal>regexp</literal>. | 716 Returns match of a string against a <literal>regexp</literal>. |
827 The optional <literal>limit</literal> parameter is an integer that specifies | 717 The optional <literal>limit</literal> parameter is an integer that specifies |
831 [ | 721 [ |
832 'a', | 722 'a', |
833 'b', | 723 'b', |
834 'c' | 724 'c' |
835 ] | 725 ] |
726 </example> | |
727 </tag-desc> | |
728 | |
729 <tag-name id="string_startswith"><literal>String.prototype.startsWith(<value>searchString</value>[, | |
730 <value>position</value>])</literal></tag-name> | |
731 <tag-desc> | |
732 Returns <literal>true</literal> if a string begins with the characters | |
733 of a specified string, otherwise <literal>false</literal>. | |
734 The optional <literal>position</literal> parameter is the position | |
735 in this string at which to begin search for <literal>searchString</literal>. | |
736 Default value is 0. | |
737 <example> | |
738 >> 'abc'.startsWith('abc') | |
739 true | |
740 > 'aabc'.startsWith('abc') | |
741 false | |
742 </example> | |
743 </tag-desc> | |
744 | |
745 <tag-name id="string_substr"><literal>String.prototype.substr(<value>start</value>[, | |
746 <value>length</value>])</literal></tag-name> | |
747 <tag-desc> | |
748 Returns the part of the string of the specified <literal>length</literal> | |
749 from <literal>start</literal> | |
750 or from <literal>start</literal> to the end of the string. | |
751 <example> | |
752 >> 'abcdefghijklmno'.substr(3, 5) | |
753 'defgh' | |
754 </example> | |
755 </tag-desc> | |
756 | |
757 <tag-name id="string_substring"><literal>String.prototype.substring(<value>start</value>[, | |
758 <value>end</value>])</literal></tag-name> | |
759 <tag-desc> | |
760 Returns the part of the string between | |
761 <literal>start</literal> and <literal>end</literal> or | |
762 from <literal>start</literal> to the end of the string. | |
763 <example> | |
764 >> 'abcdefghijklmno'.substring(3, 5) | |
765 'de' | |
766 </example> | |
767 </tag-desc> | |
768 | |
769 <tag-name id="string_tobytes"><literal>String.prototype.toBytes(start[, | |
770 end])</literal></tag-name> | |
771 <tag-desc> | |
772 (njs specific) Serializes a Unicode string to a byte string. | |
773 Returns <literal>null</literal> if a character larger than 255 is | |
774 found in the string. | |
775 </tag-desc> | |
776 | |
777 <tag-name id="string_tolowercase"><literal>String.prototype.toLowerCase()</literal></tag-name> | |
778 <tag-desc> | |
779 Converts a string to lower case. | |
780 The method supports only simple Unicode folding. | |
781 <example> | |
782 >> 'ΑΒΓΔ'.toLowerCase() | |
783 'αβγδ' | |
784 </example> | |
785 </tag-desc> | |
786 | |
787 <tag-name><literal>String.prototype.toString([<value>encoding</value>])</literal></tag-name> | |
788 <tag-desc> | |
789 <para> | |
790 If no <literal>encoding</literal> is specified, | |
791 returns a specified Unicode string or byte string as in ECMAScript. | |
792 </para> | |
793 | |
794 <para> | |
795 (njs specific) If <literal>encoding</literal> is specified, | |
796 encodes a <link id="string_tobytes">byte string</link> to | |
797 <literal>hex</literal>, | |
798 <literal>base64</literal>, or | |
799 <literal>base64url</literal>. | |
800 </para> | |
801 <example> | |
802 >> 'αβγδ'.toUTF8().toString('base64url') | |
803 'zrHOss6zzrQ' | |
804 </example> | |
805 </tag-desc> | |
806 | |
807 <tag-name id="string_touppercase"><literal>String.prototype.toUpperCase()</literal></tag-name> | |
808 <tag-desc> | |
809 Converts a string to upper case. | |
810 The method supports only simple Unicode folding. | |
811 <example> | |
812 >> 'αβγδ'.toUpperCase() | |
813 'ΑΒΓΔ' | |
814 </example> | |
815 </tag-desc> | |
816 | |
817 <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>start</value>[, | |
818 <value>end</value>])</literal></tag-name> | |
819 <tag-desc> | |
820 (njs specific) Serializes a Unicode string | |
821 to a byte string using UTF8 encoding. | |
822 <example> | |
823 >> 'αβγδ'.toUTF8().length | |
824 8 | |
825 >> 'αβγδ'.length | |
826 4 | |
827 </example> | |
828 </tag-desc> | |
829 | |
830 <tag-name id="string_trim"><literal>String.prototype.trim()</literal></tag-name> | |
831 <tag-desc> | |
832 Removes whitespaces from both ends of a string. | |
833 <example> | |
834 >> ' abc '.trim() | |
835 'abc' | |
836 </example> | 836 </example> |
837 </tag-desc> | 837 </tag-desc> |
838 | 838 |
839 <tag-name id="encodeuri"><literal>encodeURI(<value>URI</value>)</literal></tag-name> | 839 <tag-name id="encodeuri"><literal>encodeURI(<value>URI</value>)</literal></tag-name> |
840 <tag-desc> | 840 <tag-desc> |