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