Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching for strings commonly found in code using Google

Questions:

How do you search for non-alphanumeric characters when using Google?

Why doesn't Google always interpret strings enclosed within double-quotes literally?

What is Google's escape character e.g. how would I search for something that contains a double-quote?


Backgound:

I am currently learning Grails. I was reading Mastering Grails: Grails services and Google Maps (which is very good tutorial series BTW) when I came across the following line of code:

def result = [:]

By looking at the surrounding code it seems like result is defined to be some kind of map, but I wanted more information on what precisely "=[:]" does.

How do you Google something like this?

I tried searching for:

grails "[:]"

but this returns the same result set as searching for "grails".

That happens because searching just for:

"[:]"

does not return any results.

Thanks for your time!

like image 851
Heinrich Filter Avatar asked Oct 26 '22 02:10

Heinrich Filter


1 Answers

[:] is an empty map in Groovy

You can learn more about maps and collections here or focus on Groovy maps.

I think you are assuming that Google is going to do a simple 'grep' where their infrastructure is more setup to search based on a linguistic model.

You might try Google Codesearch

I would encourage you to pull up the Groovy Console (groovyConsole on the command-line if you have groovy setup) and play around with maps and lists to get the hang of it.

like image 159
Colin Harrington Avatar answered Nov 09 '22 07:11

Colin Harrington