扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 158|回复: 0

[转载发布] 可用于RMMV的JavaScript的Native函数

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-3-29 03:52
  • 签到天数: 127 天

    连续签到: 11 天

    [LV.7]常住居民III

    2350

    主题

    420

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    11311
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    14109

    灌水之王

    发表于 2024-2-20 10:33:54 | 显示全部楼层 |阅读模式
    这些函数没有被列在F1文档中(或者我没找到),在JS教程中通常会存在。

    不过我所找到的是直接使用F8调试查询到的可确保用于RMMV的函数。

    因此提供这些方便的函数,也许你会需要。

    暂时没有翻译,因为我暂时还没用到这些功能。

    JAVASCRIPT 代码
    1. function StringConstructor(a){
    2.         if( % _ArgumentsLength() == 0) a = '';
    3.         if( % _IsConstructCall()){ % _SetValueOf(this, ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a)));
    4.         }else{
    5.                 return(typeof(a) === 'symbol') ?
    6.                         % _CallFunction(a, SymbolToString) : ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a));
    7.         }
    8. }
    9. function StringToString(){
    10.         if(!(typeof(this) === 'string') && !( % _ClassOf(this) === 'String')){
    11.                 thrownew $TypeError('String.prototype.toString is not generic');
    12.         }
    13.         return %_ValueOf(this);
    14. }
    15. function StringValueOf(){
    16.         if(!(typeof(this) === 'string') && !( % _ClassOf(this) === 'String')){
    17.                 thrownew $TypeError('String.prototype.valueOf is not generic');
    18.         }
    19.         return %_ValueOf(this);
    20. }
    21. function StringCharAt(a){
    22.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.charAt"]);
    23.         var b = % _StringCharAt(this, a);
    24.         if( % _IsSmi(b)){
    25.                 b = % _StringCharAt(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), ( % _IsSmi( % IS_VAR(a)) ? a : % NumberToInteger(ToNumber(a))));
    26.         }
    27.         return b;
    28. }
    29. function StringCharCodeAt(a){
    30.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.charCodeAt"]);
    31.         var b = % _StringCharCodeAt(this, a);
    32.         if(! % _IsSmi(b)){
    33.                 b = % _StringCharCodeAt(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), ( % _IsSmi( % IS_VAR(a)) ? a : % NumberToInteger(ToNumber(a))));
    34.         }
    35.         return b;
    36. }
    37. function StringConcat(a){
    38.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.concat"]);
    39.         var b = % _ArgumentsLength();
    40.         var c = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    41.         if(b === 1){
    42.                 return c + a;
    43.         }
    44.         var d = new InternalArray(b + 1);
    45.         d[0] = c;
    46.         for(var g = 0; g < b; g++){
    47.                 var h = % _Arguments(g);
    48.                 d[g + 1] = ((typeof( % IS_VAR(h)) === 'string') ? h : NonStringToString(h));
    49.         }
    50.         return %StringBuilderConcat(d, b + 1, "");
    51. }
    52. function StringIndexOfJS(a){
    53.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.indexOf"]);
    54.         var b = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    55.         a = ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a));
    56.         var c = 0;
    57.         if( % _ArgumentsLength() > 1){
    58.                 c = % _Arguments(1);
    59.                 c = ( % _IsSmi( % IS_VAR(c)) ? c : % NumberToInteger(ToNumber(c)));
    60.                 if(c < 0) c = 0;
    61.                 if(c > b.length) c = b.length;
    62.         }
    63.         return %StringIndexOf(b, a, c);
    64. }
    65. function StringLastIndexOfJS(a){
    66.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.lastIndexOf"]);
    67.         var b = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    68.         var c = b.length;
    69.         var a = ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a));
    70.         var d = a.length;
    71.         var g = c - d;
    72.         if( % _ArgumentsLength() > 1){
    73.                 var h = ToNumber( % _Arguments(1));
    74.                 if(!(! % _IsSmi( % IS_VAR(h)) && !(h == h))){
    75.                         h = ( % _IsSmi( % IS_VAR(h)) ? h : % NumberToInteger(ToNumber(h)));
    76.                         if(h < 0){
    77.                                 h = 0;
    78.                         }
    79.                         if(h + d < c){
    80.                                 g = h;
    81.                         }
    82.                 }
    83.         }
    84.         if(g < 0){
    85.                 return-1;
    86.         }
    87.         return %StringLastIndexOf(b, a, g);
    88. }
    89. function StringLocaleCompareJS(a){
    90.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.localeCompare"]);
    91.         return %StringLocaleCompare(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a)));
    92. }
    93. function StringMatchJS(a){
    94.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.match"]);
    95.         var b = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    96.         if(( % _IsRegExp(a))){
    97.                 var c = a.lastIndex;
    98.                 ( % _IsSmi( % IS_VAR(c)) ? c : ToNumber(c));
    99.                 if(!a.global)return RegExpExecNoTests(a, b, 0);
    100.                 var d = % StringMatch(b, a, lastMatchInfo);
    101.                 if(d !== null) lastMatchInfoOverride = null;
    102.                 a.lastIndex = 0;
    103.                 return d;
    104.         }
    105.         a = new $RegExp(a);
    106.         return RegExpExecNoTests(a, b, 0);
    107. }
    108. var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
    109. function StringNormalizeJS(a){
    110.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.normalize"]);
    111.         var a = a ? ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a)) : 'NFC';
    112.         var b = NORMALIZATION_FORMS.indexOf(a);
    113.         if(b === -1){
    114.                 thrownew $RangeError('The normalization form should be one of ' + NORMALIZATION_FORMS.join(', ') + '.');
    115.         }
    116.         return %_ValueOf(this);
    117. }
    118. var reusableMatchInfo = [2, "", "", -1, -1];
    119. function StringReplace(a, b){
    120.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.replace"]);
    121.         var c = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    122.         if(( % _IsRegExp(a))){
    123.                 var d = a.lastIndex;
    124.                 ( % _IsSmi( % IS_VAR(d)) ? d : ToNumber(d));
    125.                 if(!( % _ClassOf(b) === 'Function')){
    126.                         b = ((typeof( % IS_VAR(b)) === 'string') ? b : NonStringToString(b));
    127.                         if(!a.global){
    128.                                 var g = DoRegExpExec(a, c, 0);
    129.                                 if(g == null){
    130.                                         a.lastIndex = 0
    131.                                         return c;
    132.                                 }
    133.                                 if(b.length == 0){
    134.                                         return %_SubString(c, 0, g[3]) +
    135.                                                 % _SubString(c, g[4], c.length)
    136.                                 }
    137.                                 return ExpandReplacement(b, c, lastMatchInfo, % _SubString(c, 0, g[3])) +
    138.                                         % _SubString(c, g[4], c.length);
    139.                         }
    140.                         a.lastIndex = 0;
    141.                         if(lastMatchInfoOverride == null){
    142.                                 return %StringReplaceGlobalRegExpWithString(
    143.                                         c, a, b, lastMatchInfo);
    144.                         }else{
    145.                                 var h = lastMatchInfo[1];
    146.                                 lastMatchInfo[1] = 0;
    147.                                 var i = % StringReplaceGlobalRegExpWithString(
    148.                                         c, a, b, lastMatchInfo);
    149.                                 if( % _IsSmi(lastMatchInfo[1])){
    150.                                         lastMatchInfo[1] = h;
    151.                                 }else{
    152.                                         lastMatchInfoOverride = null;
    153.                                 }
    154.                                 return i;
    155.                         }
    156.                 }
    157.                 if(a.global){
    158.                         return StringReplaceGlobalRegExpWithFunction(c, a, b);
    159.                 }
    160.                 return StringReplaceNonGlobalRegExpWithFunction(c, a, b);
    161.         }
    162.         a = ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a));
    163.         if(a.length == 1 &&
    164.                 c.length > 0xFF &&
    165.                 (typeof(b) === 'string') &&
    166.                 % StringIndexOf(b, '$', 0) < 0){
    167.                 return %StringReplaceOneCharWithString(c, a, b);
    168.         }
    169.         var j = % StringIndexOf(c, a, 0);
    170.         if(j < 0)return c;
    171.         var k = j + a.length;
    172.         var l = % _SubString(c, 0, j);
    173.         if(( % _ClassOf(b) === 'Function')){
    174.                 var m = % GetDefaultReceiver(b);
    175.                 l += % _CallFunction(m, a, j, c, b);
    176.         }else{
    177.                 reusableMatchInfo[3] = j;
    178.                 reusableMatchInfo[4] = k;
    179.                 l = ExpandReplacement(((typeof( % IS_VAR(b)) === 'string') ? b : NonStringToString(b)),
    180.                         c,
    181.                         reusableMatchInfo,
    182.                         l);
    183.         }
    184.         return l + % _SubString(c, k, c.length);
    185. }
    186. function ExpandReplacement(a, b, c, d){
    187.         var g = a.length;
    188.         var h = % StringIndexOf(a, '$', 0);
    189.         if(h < 0){
    190.                 if(g > 0) d += a;
    191.                 return d;
    192.         }
    193.         if(h > 0) d += % _SubString(a, 0, h);
    194.         while(true){
    195.                 var i = '$';
    196.                 var j = h + 1;
    197.                 if(j < g){
    198.                         var k = % _StringCharCodeAt(a, j);
    199.                         if(k == 36){
    200.                                 ++j;
    201.                                 d += '$';
    202.                         }elseif(k == 38){
    203.                                 ++j;
    204.                                 d +=
    205.                                         % _SubString(b, c[3], c[4]);
    206.                         }elseif(k == 96){
    207.                                 ++j;
    208.                                 d += % _SubString(b, 0, c[3]);
    209.                         }elseif(k == 39){
    210.                                 ++j;
    211.                                 d += % _SubString(b, c[4], b.length);
    212.                         }elseif(k >= 48 && k > 11) + (m & 0x7ff);
    213.                                 }else{
    214.                                         i = g[++l] - m;
    215.                                 }
    216.                         }else{
    217.                                 j[0] = m;
    218.                                 j[1] = i;
    219.                                 lastMatchInfoOverride = j;
    220.                                 var o = % _CallFunction(k, m, i, a, c);
    221.                                 g[l] = ((typeof( % IS_VAR(o)) === 'string') ? o : NonStringToString(o));
    222.                                 i += m.length;
    223.                         }
    224.                 }
    225.         }else{
    226.                 var k = % GetDefaultReceiver(c);
    227.                 for(var l = 0; l < h; l++){
    228.                         var m = g[l];
    229.                         if(! % _IsSmi(m)){
    230.                                 lastMatchInfoOverride = m;
    231.                                 var o = % Apply(c, k, m, 0, m.length);
    232.                                 g[l] = ((typeof( % IS_VAR(o)) === 'string') ? o : NonStringToString(o));
    233.                         }
    234.                 }
    235.         }
    236.         var q = % StringBuilderConcat(g, g.length, a);
    237.         d.length = 0;
    238.         reusableReplaceArray = d;
    239.         return q;
    240. }
    241. function StringReplaceNonGlobalRegExpWithFunction(a, b, c){
    242.         var d = DoRegExpExec(b, a, 0);
    243.         if((d === null)){
    244.                 b.lastIndex = 0;
    245.                 return a;
    246.         }
    247.         var g = d[3];
    248.         var h = % _SubString(a, 0, g);
    249.         var i = d[4];
    250.         var j = ((d)[0]) >> 1;
    251.         var k;
    252.         var l = % GetDefaultReceiver(c);
    253.         if(j == 1){
    254.                 var m = % _SubString(a, g, i);
    255.                 k = % _CallFunction(l, m, g, a, c);
    256.         }else{
    257.                 var o = new InternalArray(j + 2);
    258.                 for(var q = 0; q < j; q++){
    259.                         o[q] = CaptureString(a, d, q);
    260.                 }
    261.                 o[q] = g;
    262.                 o[q + 1] = a;
    263.                 k = % Apply(c, l, o, 0, q + 2);
    264.         }
    265.         h += k;
    266.         return h + % _SubString(a, i, a.length);
    267. }
    268. function StringSearch(a){
    269.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.search"]);
    270.         var b;
    271.         if((typeof(a) === 'string')){
    272.                 b = % _GetFromCache(0, a);
    273.         }elseif(( % _IsRegExp(a))){
    274.                 b = a;
    275.         }else{
    276.                 b = new $RegExp(a);
    277.         }
    278.         var c = DoRegExpExec(b, ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), 0);
    279.         if(c){
    280.                 return c[3];
    281.         }
    282.         return-1;
    283. }
    284. function StringSlice(a, b){
    285.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.slice"]);
    286.         var c = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    287.         var d = c.length;
    288.         var g = ( % _IsSmi( % IS_VAR(a)) ? a : % NumberToInteger(ToNumber(a)));
    289.         var h = d;
    290.         if(!(b === (void0))){
    291.                 h = ( % _IsSmi( % IS_VAR(b)) ? b : % NumberToInteger(ToNumber(b)));
    292.         }
    293.         if(g < 0){
    294.                 g += d;
    295.                 if(g < 0){
    296.                         g = 0;
    297.                 }
    298.         }else{
    299.                 if(g > d){
    300.                         return'';
    301.                 }
    302.         }
    303.         if(h < 0){
    304.                 h += d;
    305.                 if(h < 0){
    306.                         return'';
    307.                 }
    308.         }else{
    309.                 if(h > d){
    310.                         h = d;
    311.                 }
    312.         }
    313.         if(h >> 0);
    314.         var d = c.length;
    315.         if(!( % _IsRegExp(a))){
    316.                 var g = ((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a));
    317.                 if(b === 0)return[];
    318.                 if((a === (void0)))return[c];
    319.                 var h = g.length;
    320.                 if(h === 0)return %StringToArray(c, b);
    321.                 var i = % StringSplit(c, g, b);
    322.                 return i;
    323.         }
    324.         if(b === 0)return[];
    325.         return StringSplitOnRegExp(c, a, b, d);
    326. }
    327. function StringSplitOnRegExp(a, b, c, d){
    328.         if(d === 0){
    329.                 if(DoRegExpExec(b, a, 0, 0) != null){
    330.                         return[];
    331.                 }
    332.                 return[a];
    333.         }
    334.         var g = 0;
    335.         var h = 0;
    336.         var i = 0;
    337.         var j = new InternalArray();
    338.         outer_loop:
    339.                 while(true){
    340.                         if(h === d){
    341.                                 j[j.length] = % _SubString(a, g, d);
    342.                                 break;
    343.                         }
    344.                         var k = DoRegExpExec(b, a, h);
    345.                         if(k == null || d === (i = k[3])){
    346.                                 j[j.length] = % _SubString(a, g, d);
    347.                                 break;
    348.                         }
    349.                         var l = k[4];
    350.                         if(h === l && l === g){
    351.                                 h++;
    352.                                 continue;
    353.                         }
    354.                         j[j.length] = % _SubString(a, g, i);
    355.                         if(j.length === c)break;
    356.                         var m = ((k)[0]) + 3;
    357.                         for(var o = 3 + 2; o < m;){
    358.                                 var q = k[o++];
    359.                                 var r = k[o++];
    360.                                 if(r != -1){
    361.                                         j[j.length] = % _SubString(a, q, r);
    362.                                 }else{
    363.                                         j[j.length] = (void0);
    364.                                 }
    365.                                 if(j.length === c)break outer_loop;
    366.                         }
    367.                         h = g = l;
    368.                 }
    369.         var t = []; % MoveArrayContents(j, t);
    370.         return t;
    371. }
    372. function StringSubstring(a, b){
    373.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.subString"]);
    374.         var c = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    375.         var d = c.length;
    376.         var g = ( % _IsSmi( % IS_VAR(a)) ? a : % NumberToInteger(ToNumber(a)));
    377.         if(g < 0){
    378.                 g = 0;
    379.         }elseif(g > d){
    380.                 g = d;
    381.         }
    382.         var h = d;
    383.         if(!(b === (void0))){
    384.                 h = ( % _IsSmi( % IS_VAR(b)) ? b : % NumberToInteger(ToNumber(b)));
    385.                 if(h > d){
    386.                         h = d;
    387.                 }else{
    388.                         if(h < 0) h = 0;
    389.                         if(g > h){
    390.                                 var i = h;
    391.                                 h = g;
    392.                                 g = i;
    393.                         }
    394.                 }
    395.         }
    396.         return %_SubString(c, g, h);
    397. }
    398. function StringSubstr(a, b){
    399.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.substr"]);
    400.         var c = ((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this));
    401.         var d;
    402.         if((b === (void0))){
    403.                 d = c.length;
    404.         }else{
    405.                 d = ( % _IsSmi( % IS_VAR(b)) ? b : % NumberToInteger(ToNumber(b)));
    406.                 if(d = c.length)return'';
    407.                 if(a < 0){
    408.                         a += c.length;
    409.                         if(a < 0) a = 0;
    410.                 }
    411.         }
    412.         var g = a + d;
    413.         if(g > c.length) g = c.length;
    414.         return %_SubString(c, a, g);
    415. }
    416. function StringToLowerCaseJS(){
    417.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.toLowerCase"]);
    418.         return %StringToLowerCase(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)));
    419. }
    420. function StringToLocaleLowerCase(){
    421.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.toLocaleLowerCase"]);
    422.         return %StringToLowerCase(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)));
    423. }
    424. function StringToUpperCaseJS(){
    425.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.toUpperCase"]);
    426.         return %StringToUpperCase(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)));
    427. }
    428. function StringToLocaleUpperCase(){
    429.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.toLocaleUpperCase"]);
    430.         return %StringToUpperCase(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)));
    431. }
    432. function StringTrimJS(){
    433.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.trim"]);
    434.         return %StringTrim(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), true, true);
    435. }
    436. function StringTrimLeft(){
    437.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.trimLeft"]);
    438.         return %StringTrim(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), true, false);
    439. }
    440. function StringTrimRight(){
    441.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.trimRight"]);
    442.         return %StringTrim(((typeof( % IS_VAR(this)) === 'string') ? this : NonStringToString(this)), false, true);
    443. }
    444. function StringFromCharCode(a){
    445.         var b = % _ArgumentsLength();
    446.         if(b == 1){
    447.                 if(! % _IsSmi(a)) a = ToNumber(a);
    448.                 return %_StringCharFromCode(a & 0xffff);
    449.         }
    450.         var c = % NewString(b, true);
    451.         var d;
    452.         for(d = 0; d < b; d++){
    453.                 var a = % _Arguments(d);
    454.                 if(! % _IsSmi(a)) a = ToNumber(a) & 0xffff;
    455.                 if(a < 0) a = a & 0xffff;
    456.                 if(a > 0xff)break; % _OneByteSeqStringSetChar(d, a, c);
    457.         }
    458.         if(d == b)return c;
    459.         c = % TruncateString(c, d);
    460.         var g = % NewString(b - d, false);
    461.         for(var h = 0; d < b; d++, h++){
    462.                 var a = % _Arguments(d);
    463.                 if(! % _IsSmi(a)) a = ToNumber(a) & 0xffff; % _TwoByteSeqStringSetChar(h, a, g);
    464.         }
    465.         return c + g;
    466. }
    467. function HtmlEscape(a){
    468.         return((typeof( % IS_VAR(a)) === 'string') ? a : NonStringToString(a)).replace(/"/g, """);
    469. }
    470. function StringAnchor(a){
    471.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.anchor"]);
    472.         return"" + this + "";
    473. }
    474. function StringBig(){
    475.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.big"]);
    476.         return"" + this + "";
    477. }
    478. function StringBlink(){
    479.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.blink"]);
    480.         return"" + this + "";
    481. }
    482. function StringBold(){
    483.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.bold"]);
    484.         return"" + this + "";
    485. }
    486. function StringFixed(){
    487.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.fixed"]);
    488.         return"" + this + "";
    489. }
    490. function StringFontcolor(a){
    491.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.fontcolor"]);
    492.         return"" + this + "";
    493. }
    494. function StringFontsize(a){
    495.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.fontsize"]);
    496.         return"" + this + "";
    497. }
    498. function StringItalics(){
    499.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.italics"]);
    500.         return"" + this + "";
    501. }
    502. function StringLink(a){
    503.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.link"]);
    504.         return"" + this + "";
    505. }
    506. function StringSmall(){
    507.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.small"]);
    508.         return"" + this + "";
    509. }
    510. function StringStrike(){
    511.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.strike"]);
    512.         return"" + this + "";
    513. }
    514. function StringSub(){
    515.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.sub"]);
    516.         return"" + this + "";
    517. }
    518. function StringSup(){
    519.         if((this == null) && !( % _IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined', ["String.prototype.sup"]);
    520.         return"" + this + "";
    521. }
    522. function SetUpString(){ % CheckIsBootstrapping(); % SetCode($String, StringConstructor); % FunctionSetPrototype($String, new $String()); % AddNamedProperty($String.prototype, "constructor", $String, 2);
    523.         InstallFunctions($String, 2, $Array(
    524.                 "fromCharCode", StringFromCharCode
    525.         ));
    526.         InstallFunctions($String.prototype, 2, $Array(
    527.                 "valueOf", StringValueOf,
    528.                 "toString", StringToString,
    529.                 "charAt", StringCharAt,
    530.                 "charCodeAt", StringCharCodeAt,
    531.                 "concat", StringConcat,
    532.                 "indexOf", StringIndexOfJS,
    533.                 "lastIndexOf", StringLastIndexOfJS,
    534.                 "localeCompare", StringLocaleCompareJS,
    535.                 "match", StringMatchJS,
    536.                 "normalize", StringNormalizeJS,
    537.                 "replace", StringReplace,
    538.                 "search", StringSearch,
    539.                 "slice", StringSlice,
    540.                 "split", StringSplitJS,
    541.                 "substring", StringSubstring,
    542.                 "substr", StringSubstr,
    543.                 "toLowerCase", StringToLowerCaseJS,
    544.                 "toLocaleLowerCase", StringToLocaleLowerCase,
    545.                 "toUpperCase", StringToUpperCaseJS,
    546.                 "toLocaleUpperCase", StringToLocaleUpperCase,
    547.                 "trim", StringTrimJS,
    548.                 "trimLeft", StringTrimLeft,
    549.                 "trimRight", StringTrimRight,
    550.                 "link", StringLink,
    551.                 "anchor", StringAnchor,
    552.                 "fontcolor", StringFontcolor,
    553.                 "fontsize", StringFontsize,
    554.                 "big", StringBig,
    555.                 "blink", StringBlink,
    556.                 "bold", StringBold,
    557.                 "fixed", StringFixed,
    558.                 "italics", StringItalics,
    559.                 "small", StringSmall,
    560.                 "strike", StringStrike,
    561.                 "sub", StringSub,
    562.                 "sup", StringSup
    563.         ));
    564. }
    565. SetUpString();
    复制代码

                 本帖来自P1论坛作者MonsterJohnCN,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=384597  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-4-20 19:54 , Processed in 0.063951 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表