smart solutions for small devices
[ start | index | login ]
start > Fun > mfResult

mfResult

Created by bjoernQ. Last edited by bjoernQ, 5 years and 23 days ago. Viewed 499 times. #38
[diff] [history] [edit] [rdf]
labels
Typetext/gsp
attachments
The score of the mobile friendliness of your URL is <% str = ""+URL;

char2points1 = "1234567890" , " adgjmptw" , " behknqux" , " cfilorvy" , " s z";

char2points2 = 2 , 1 , 2 , 3 , 4;

long points = 0; int lastIndex = -1;

for( i in 0..(str.length()-1) ){ c = stri; boolean found = false;

for( j in 0 .. char2points1.size()-1 ){ int idx = char2points1j.indexOf(c);

if( idx >=0 ){ if(idx==lastIndex){ points+=1; } // aufeinanderfolgende zeichen lastIndex=idx;

points+= char2points2j ; found = true; break; }

} if(!found){ points+=2; }

}

println(""+points);

%>

(A lower score is better)

Please login to post a comment.
www.mobile-j.de | Bjoern Quentin