21 Août 2014

Base64_Encode and Decode

Category: OOEnky @ 13 h 41 min

Base64_encode.

  1. var base64_encode = function (a,b,c,d,e,f) {
  2.         b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  3.         c="=";
  4.         for(d=f="";e&amp;=3,a.charAt(d++)||(b="=",e);f+=b.charAt(63&amp;c>>++e*2))c=c<<8|a.charCodeAt(d-=!e);
  5.         return f
  6. };
  7.  
  8. coded = base64_encode(scriptletInput);
  9. scriptletResult = coded;

Base64_decode

  1. var base64_decode = function( d,b,c,u,r,q,x ) {
  2.         b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  3.         for(r=q=x="";c=d.charAt(x++);~c&amp;&amp;(u=q%4?u*64+c:c,q++%4)?r+=String.fromCharCode(255&amp;u>>(-2*q&amp;6)):0) c=b.indexOf(c);
  4.         return r;
  5. };
  6.  
  7. decoded = base64_decode(scriptletInput);
  8. scriptletResult = decoded;
  9.  

source

Facebook Twitter Email Linkedin Digg Delicious Reddit Stumbleupon Tumblr

Étiquettes : ,


08 Sep 2011

Add a word at the end of a chain to a first specific letter.

Category: OOEnky @ 10 h 07 min

 

  1.  
  2. if ( (scriptletInput.charAt(0) == ‘P’) || (scriptletInput.charAt(0) == ‘p’) ){
  3.                 scriptletResult=scriptletInput+‘_prod’;
  4. } else {
  5.                         scriptletResult=scriptletInput;
  6. }
  7.  
Facebook Twitter Email Linkedin Digg Delicious Reddit Stumbleupon Tumblr

Étiquettes : ,


15 Juil 2011

Remove Excess Commas

Category: HP,OOEnky @ 3 h 57 min

 

  1. var result="";
  2. var tabPli = scriptletInput.split(‘,’);
  3. for (var i=0; i<tabPli.length; i++) {
  4.  if(tabPli[i] != ""){
  5.     if (result!=""){
  6.         result = result+","+tabPli[i];
  7.     } else {
  8.         result = tabPli[i];
  9.     }
  10.  }
  11. }
  12. scriptletResult = result;
Facebook Twitter Email Linkedin Digg Delicious Reddit Stumbleupon Tumblr

Étiquettes : ,


13 Juil 2011

Uppercase First Letter

Category: HP,OOEnky @ 13 h 43 min

 

  1. if (scriptletInput.length>0){
  2. scriptletResult = scriptletInput.substr(0,1).toUpperCase()+
  3. scriptletInput.substr(1,scriptletInput.length)
  4. } else {
  5. scriptletResult=""
  6. }
Facebook Twitter Email Linkedin Digg Delicious Reddit Stumbleupon Tumblr

Étiquettes : ,