如何用字符串调用eval

时间:2018-03-30 15:17:07

标签: javascript eval

我有一个格式为eval的字符串如何用字符串(上面)参数调用eval(function (p, r, o, x, y, s) { y = function (c) { return (c < r ? '' : y(parseInt(c / r))) + ((c = c % r) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (o--) { s[y(o)] = x[o] || y(o) } x = [function (y) { return s[y] }]; y = function () { return '\\w+' }; o = 3 }; while (o--) { if (x[o]) { p = p.replace(new RegExp('\\b' + y(o) + '\\b', 'g'), x[o]) } } return p }('o=D^C;p=9;h=1;q=B^E;s=6;k=2;t=F^A;i=G^I;c=y^u;r=7;f=0;l=5;d=4;n=8;a=w^z;g=x^v;b=3;e=H^W;j=V^X;m=U^S;J=f^j;T=h^i;M=k^g;L=b^a;K=d^e;N=l^m;O=s^t;R=r^q;Q=n^o;P=p^c;', 60, 60, '^^^^^^^^^^Four9Eight^Seven^FourSevenOne^Three^Two4Nine^One^Two6Seven^Two^Nine7Three^FiveSixFive^Four^Eight^Four2Zero^Six^ThreeSixFour^Zero^FiveTwoTwo^Nine^Five^ZeroOneSix^8909^8090^3162^8795^3898^80^81^5219^3127^9348^9090^10629^4355^1070^6588^NineEightTwoFour^Four6ZeroSeven^Three5SixEight^Six4OneZero^ThreeSevenFiveThree^Three9ThreeOne^Eight3NineTwo^TwoSevenSevenFive^Two0FourNine^1337^Six6EightSix^5347^8094^808^8080'.split('\u005e'), 0, {}))

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <View  <!--I change its color in the Java code-->
        android:tag="color0" 
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignParentStart="true"
        android:id="@+id/view1"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:paddingLeft="15dp"
        android:text="Name"
        android:layout_toRightOf="@id/view1"
        android:tag="text1"
        android:gravity="center_vertical"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="U$ 32,44"
        android:layout_alignParentEnd="true"
        android:paddingRight="15dp"
        android:paddingLeft="15dp"
        android:id="@+id/money1"
        android:gravity="center_vertical"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="03/03/2018"
        android:layout_toLeftOf="@id/money1"
        android:id="@+id/data1"
        android:gravity="center_vertical"/>
</RelativeLayout>

0 个答案:

没有答案