Differentiate two string(almost same)

string

#1

Hello Team,
actually i was working with string,
that can be “WBR2” or “WBR2A

how can i differentiate this so based on that further processing is done
i was using string.contains(“WBR2”) condition in IF-ELSE
but it is taking both values
need some help

thanx in advance


#2

@prathamesh.c,

Two ways to differentiate,

  1. String.Equals(“WBR2”)
  2. String.Contains(“WBR2A”)

Regards,
Dominic :slight_smile:


#3

Hi @prathamesh.c,

For Example
strFirst =WBR2
strSecond=WBR2A

if you are using contains both the value match because of both the string having WBR2.

If you want exact match use below code

use Equals method or =

  • strFirst.Equals(strSecond)
  • strFirst=strSecond

Regards,
Arivu