-
Notifications
You must be signed in to change notification settings - Fork 0
String
title: String permalink: GroovyNotes/String category: GroovyNotes parent: GroovyNotes layout: default has_children: false share: true shortRepo:
- groovynotes
- default
Table of contents
{: .text-delta } 1. TOC {:toc}crea@groovy.transform.ToString
Used for classes to establish to string
‘’’ … ‘’’ three single quotes creates a multiline string obj
Str -= “rainy” will remove rainy from the string
Use stripIndent() or stripMargin() remove indents
stripMargin(‘char’) indicates what lines, or | by default
"""<p><strong>Scheduled Interview Summary</strong></p>
|<p><strong>Company</strong>: @@company@@<br>""".stripMargin()"abc".tr('abc', '321')Java char saved as int per ascii
Def x = 'a'
(int) x - 96 = 1The split() method returns a string [] instance and the tokenize() method returns a list instance
tokenize() ,which returns a list, will ignore empty string (when a delimiter appears twice in succession) where as split() keeps such string.
Will get letters at index 0 through 3
word[1,6,0] get letters index 1,6, and 0