Groovy – minus()

  • Post author:
  • Post category:Groovy
  • Post comments:1 Comment
Removes

Removes the value part of the String.

Syntax

String minus(Object value)

Parameters

Value โ€“ the string object which needs to be removed

Return Value

The new string minus the value of the object value.

Example

Following is an example of the usage of this method โˆ’

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

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

Hello  
World

Previous Page:-Click Here

This Post Has One Comment

Leave a Reply