Groovy – String Length

  • Post author:
  • Post category:Groovy
  • Post comments:2 Comments
string

Syntax โˆ’ The length of the string is determined by the length() method of the string.

Parameters โˆ’ No parameters.

Return Value โˆ’ An Integer showing the length of the string.

Example

Following is an example of the usage of strings in Groovy โˆ’

class Example {
   static void main(String[] args) {
      String a = "Hello";
      println(a.length());
   } 
}

When we run the above program, we will get the following result โˆ’

5

Previous Page:-Click Here

This Post Has 2 Comments

  1. MY COMPANY

    Great, thanks for sharing this article. Really Great.

Leave a Reply