Skip to content

Instantly share code, notes, and snippets.

@srigalamilitan
Created February 15, 2016 09:16
Show Gist options
  • Save srigalamilitan/ef25008147a220a57a3a to your computer and use it in GitHub Desktop.
Save srigalamilitan/ef25008147a220a57a3a to your computer and use it in GitHub Desktop.
Learn_StringUtils apache common lang3 www.putracode.com
"C:\Program Files\Java\jdk1.8.0_51\bin\java" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files\Java\jdk1.8.0_51\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\zipfs.jar;E:\_GITHUB\PC-COMMONS-LANG3\target\classes;C:\Users\KrisnaPutra\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.putracode.common.Learn_StringUtils
*********************************************
Learn Using StringUtils : Apache Commons Langs
*********************************************
String Utils Have a Common Use Static Variable :
Static Var "CR" :A String for Carriage ('\n')
Static Var "EMPTY" : Empty String ""
Static Var "SPACE" : A String for line feed LF -->
<--
Static Var "INDEX_NOT_FOUND" : Represents a failed index search. Value --> -1
>>>>Checker Null, Blank , Empty
Blank And Empty String Checker :
--Sample String "null", Is Blank : true, Is Empty : true
--Sample String "", Is Blank : true, Is Empty : true
--Sample String " ", Is Blank : true, Is Empty : false
--Sample String "putracode", Is Blank : false, Is Empty : false
--Sample String " putracode ", Is Blank : false, Is Empty : false
<<<<<
Reverse String (PUTRACODE) : EDOCARTUP
>>>>Check Content Of String , Numeric, AlphaNumeric, Alpha, Ascii,Whitespace, All Upper Case , All Lower Case
##################################################
--Sample String : "null"
-----Is Numeric : false -----Is Apha : false
-----Is AphaNumeric : false -----Is Ascii : false
-----Is WhiteSpace : false -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : false
##################################################
--Sample String : ""
-----Is Numeric : false -----Is Apha : false
-----Is AphaNumeric : false -----Is Ascii : true
-----Is WhiteSpace : true -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : true
##################################################
--Sample String : " "
-----Is Numeric : false -----Is Apha : false
-----Is AphaNumeric : false -----Is Ascii : true
-----Is WhiteSpace : true -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : true
##################################################
--Sample String : "Alpha"
-----Is Numeric : false -----Is Apha : true
-----Is AphaNumeric : true -----Is Ascii : true
-----Is WhiteSpace : false -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : false
##################################################
--Sample String : "AlphaNumeric123"
-----Is Numeric : false -----Is Apha : false
-----Is AphaNumeric : true -----Is Ascii : true
-----Is WhiteSpace : false -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : false
##################################################
--Sample String : "@#$%^&*()"
-----Is Numeric : false -----Is Apha : false
-----Is AphaNumeric : false -----Is Ascii : true
-----Is WhiteSpace : false -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : false
##################################################
--Sample String : "lowercase"
-----Is Numeric : false -----Is Apha : true
-----Is AphaNumeric : true -----Is Ascii : true
-----Is WhiteSpace : false -----Is All Upper Case : false
-----Is All Lower Case : true -----Is Is Numeric With Space : false
##################################################
--Sample String : "UPPERCASE"
-----Is Numeric : false -----Is Apha : true
-----Is AphaNumeric : true -----Is Ascii : true
-----Is WhiteSpace : false -----Is All Upper Case : true
-----Is All Lower Case : false -----Is Is Numeric With Space : false
##################################################
--Sample String : "123 123 123"
-----Is Numeric : false -----Is Apha : false
-----Is AphaNumeric : false -----Is Ascii : true
-----Is WhiteSpace : false -----Is All Upper Case : false
-----Is All Lower Case : false -----Is Is Numeric With Space : true
<<<<<
>>>>Join Data to String
Join Array with default separator(no Sperator): AlphaAlphaNumeric123@#$%^&*()lowercaseUPPERCASE123 123 123
Join Array with with Specific separator (,) : ,, ,Alpha,AlphaNumeric123,@#$%^&*(),lowercase,UPPERCASE,123 123 123
<<<<<
>>>>Default Value String
--Sample String "null", Is Blank : -BLANK-, Is Empty : Empty
--Sample String "", Is Blank : -BLANK-, Is Empty : Empty
--Sample String " ", Is Blank : -BLANK-, Is Empty :
--Sample String "putracode", Is Blank : putracode, Is Empty : putracode
--Sample String " putracode ", Is Blank : putracode , Is Empty : putracode
<<<<<
>>>>Contains ,Difference,LevenshteinDistance, CommonPrefix
Contains xx at string PUTRAxxCode : true
Contains Any xx,ZZ at string PUTRAxxCode : true
Contains Only xx at string PUTRAxxCode : false
Contains Ignore Case XX at string PUTRAxxCode : true
Contains WhiteSpace at string PUTRAxxCode : false
Contains None XX at string PUTRAxxCode : true
Get Difference Using : PutraCode vs PutraXXCode is XXCode
Get LevenshteinDistance : PutraCode vs PutraXXCode is 2
Get Common Prefix : ab,abc,a is a
<<<<<
Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment