title: How to check if an instance is of type String or GString in Groovy
body: <p>I would like to learn what the robust way of checking, if a variable is of type string or gstring, is. I suppose it is different than in pure Java:</p>
  
  <pre><code>def var = someFunc();
  
  if (var instanceof String || var instanceof GString) {
     String str = var;
  }
  </code></pre>
  
  <p>I ask, because I do not want to be surprised that I have missed a Groovy specific feature that causes a hard to debug bug.</p>