def outputLog = """6ec3701eebdeeded2d12c5ec56bd34c29e8da9a7 unittest_generator_14 (#16) [email protected] [email protected] ffdefd3112529d3cddde36438f5cf176415c72c6 #description check slack notifications (#33) [email protected] [email protected] 5be4cfd6284d9d18dbabf0993e7a9dc12e3b6530 [SEO] Block a specific help center article (#18) [email protected] [email protected] 405e2a2f78769af3672cd32c8d3c240a634bec94 Gladly - HearMe - added temp logs to debug note added events (#4) [email protected] [email protected] b692d9a9ee884ba8fcb65d0276599d252fb6106f Merge pull request #30 [email protected] [email protected] 3bc195c07ef41de461e2d19fca806ce56021555b Ancestor_Completer_Utility_04 (#17) [email protected] [email protected] 047e96764ab51b4d4893ce0eaf30949a68932b58 [Security][Offline Exec] Rename 'OfflineExecGetPostGlobalsCmdLineParams' trait to 'OfflineExecCommonGlobalsCmdLineParamsAware' due to its change in responsibility (#26) [email protected] [email protected] 91f357a5da5842f0b9e2a5c4386245ff60be3399 Fixes "FamilyGraph doc site - most object doc text is missing" (#24) [email protected] [email protected] 8fae49e80743a94888ec16ad0257545d55c40772 [QS-2383] Add new records, adjust collections filtering based on env (#22) [email protected] [email protected] 8f25aa1283845f0fd2ddfa1ef974217bd50c6bf7 Fix oldnews thumb section view on record page (#6) [email protected] [email protected]% /Volumes/mhdev/working-copies/web/trunk master ⇣17 ?4 ❯ git log --pretty=format:'%H %s %ce %ae' -n 11 Ruby 2.7.2 6ec3701eebdeeded2d12c5ec56bd34c29e8da9a7 unittest_generator_14 (#16) [email protected] [email protected] ffdefd3112529d3cddde36438f5cf176415c72c6 #description check slack notifications (#33) [email protected] [email protected] 5be4cfd6284d9d18dbabf0993e7a9dc12e3b6530 [SEO] Block a specific help center article (#18) [email protected] [email protected] 405e2a2f78769af3672cd32c8d3c240a634bec94 Gladly - HearMe - added temp logs to debug note added events (#4) [email protected] [email protected] b692d9a9ee884ba8fcb65d0276599d252fb6106f Merge pull request #30 [email protected] [email protected] 3bc195c07ef41de461e2d19fca806ce56021555b Ancestor_Completer_Utility_04 (#17) [email protected] [email protected] 047e96764ab51b4d4893ce0eaf30949a68932b58 [Security][Offline Exec] Rename 'OfflineExecGetPostGlobalsCmdLineParams' trait to 'OfflineExecCommonGlobalsCmdLineParamsAware' due to its change in responsibility (#26) [email protected] [email protected] 91f357a5da5842f0b9e2a5c4386245ff60be3399 Fixes "FamilyGraph doc site - most object doc text is missing" (#24) [email protected] [email protected] 8fae49e80743a94888ec16ad0257545d55c40772 [QS-2383] Add new records, adjust collections filtering based on env (#22) [email protected] [email protected] 8f25aa1283845f0fd2ddfa1ef974217bd50c6bf7 Fix oldnews thumb section view on record page (#6) [email protected] [email protected] e9f6cae631b36b03cc86018043d344df57bac517 #description test with description in title (#14) [email protected] [email protected] """ def lines = outputLog.split('\n') def hashes = [] def titles = [] def emails = [] def authors = [] lines.each { line -> if (line.trim()) { def parts = line.split(' ') hashes << parts[0] def title = parts[1..-3].join(' ') if (!title.startsWith("#description")) { title = "#description $title" } titles << title emails << parts[-2] authors << parts[-1] } } println "Hashes: $hashes" println "Titles: $titles" println "Emails: $emails" println "Authors: $authors"
Write, Run & Share Groovy code online using OneCompiler's Groovy online compiler for free. It's one of the robust, feature-rich online compilers for Groovy language, running the latest Groovy version 2.6. Getting started with the OneCompiler's Groovy editor is easy and fast. The editor shows sample boilerplate code when you choose language as Groovy and start coding.
OneCompiler's Groovy online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Groovy program which takes name as input and prints hello message with your name.
def name = System.in.newReader().readLine()
println "Hello " + name
Groovy is an object-oriented programming language based on java. Apache Groovy is a dynamic and agile language which is similar to Python, Ruby, Smalltalk etc.
Data type | Description | Range |
---|---|---|
String | To represent text literals | NA |
char | To represent single character literal | NA |
int | To represent whole numbers | -2,147,483,648 to 2,147,483,647 |
short | To represent short numbers | -32,768 to 32,767 |
long | To represent long numbers | -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 |
double | To represent 64 bit floating point numbers | 4.94065645841246544e-324d to 1.79769313486231570e+308d |
float | To represent 32 bit floating point numbers | 1.40129846432481707e-45 to 3.40282346638528860e+38 |
byte | To represent byte value | -128 to 127 |
boolean | To represent boolean values either true or false | True or False |
You can define variables in two ways
data-type variable-name;
[or]
def variable-name;
0.upto(n) {println "$it"}
or
n.times{println "$it"}
where n is the number of loops and 0 specifies the starting index
When ever you want to perform a set of operations based on a condition or set of conditions, then If / Nested-If / If-Else is used.
if(conditional-expression) {
// code
} else {
// code
}
Switch is an alternative to If-Else-If ladder and to select one among many blocks of code.
switch(conditional-expression) {
case value1:
// code
break; // optional
case value2:
// code
break; // optional
...
default:
//code to be executed when all the above cases are not matched;
}
List allows you to store ordered collection of data values.
def mylist = [1,2,3,4,5];
List Methods | Description |
---|---|
size() | To find size of elements |
sort() | To sort the elements |
add() | To append new value at the end |
contains() | Returns true if this List contains requested value. |
get() | Returns the element of the list at the definite position |
pop() | To remove the last item from the List |
isEmpty() | Returns true if List contains no elements |
minus() | This allows you to exclude few specified elements from the elements of the original |
plus() | This allows you to add few specified elements to the elements of the original |
remove() | To remove the element present at the specific position |
reverse() | To reverse the elements of the original List and creates new list |