Kayıtlar

Haziran, 2013 tarihine ait yayınlar gösteriliyor

The regex for money and currency field.

This code is grapping the number  and currency.    //var txt='200TL';       //var txt='200 TL';       //var txt='200 ';       //var txt='2000$';       //var txt='2.000.000 TL';       var txt= '2,000,000 Euro';       //var txt='20.000.000 TL';       //var txt='20.000.000';       //var txt='20.000TL';       //var txt='20.000.000TL';       var re1='(\\d*(?:\\.?\\d*\\.?\\d*))';    // Non-greedy match on filler             var re2='((?:[a-zA-Z(?\\s|\\S)]*))';// Word 1            var p = new RegExp(re1+re2,["i"]);       var m = p.exec(txt);       if (m !== null)  ...

Android Emulator Shortcuts

1. Main Device Keys Home         Home Button F2             Left Softkey / Menu / Settings button (or Page up) Shift+f2     Right Softkey / Star button (or Page down) Esc         Back Button F3             Call/ dial Button F4             Hang up / end call button F5             Search Button 2. Other Device Keys Ctrl+F5     Volume up (or + on numeric keyboard with Num Lock off) Ctrl+F6     Volume down (or + on numeric keyboard with Num Lock off) F7             Power Button Ctrl+F3     Camera Button Ctrl+F11     Switch layout orientation portrait/landscape backwards Ctrl+F12     Switch layout orientation portrait/lands...

void... params in java

There are several ways to simulate optional parameters in Java: Method overloading. void foo ( String a , Integer b ) { //... } void foo ( String a ) { foo ( a , 0 ); // here, 0 is a default value for b } foo ( "a" , 2 ); foo ( "a" ); One of the limitations of this approach is that it doesn't work if you have two optional parameters of the same type and any of them can be omitted. Varargs. a) All optional parameters are of the same type: void foo ( String a , Integer ... b ) { Integer b1 = b . length > 0 ? b [ 0 ] : 0 ; Integer b2 = b . length > 1 ? b [ 1 ] : 0 ; //... } foo ( "a" ); foo ( "a" , 1 , 2 ); b) Types of optional parameters may be different: void foo ( String a , Object ... b ) { Integer b1 = 0 ; String b2 = "" ; if ( b . length > 0 ) { if (!( b [ 0 ] instanceof Integer )) { ...