String a = 'string'
String b = 'This is a strin'
println b.containsSimilarity(a)
Is there a function like imaginary containsSimilarity in Groovy which to say the differences of strings,so I want to search for "string" in "This is a strin" and after comparison to say that 83% of String "string" is found in "This is a strin". Something like assertions when using Spock
assert "string"=="string"
result is:
"string"=="strin" | false 1 difference (83% similarity) strin(g) strin(-)
How I can do this in Groovy? So not to compare two strings, but to find how big part of String a is containing in String b. If a is part of b ->true, else false and print similarity percentage and show where is the difference.