I want to compare two strings for maximum comparsion how can i do that?

for example Var1= My name is John Stark , Var2= Stark John , I want to go for further logic because Var1 contains John stark . I tried to do that using Contains operation but not able to do it? Can anyone please help

image

1 Like

Hey! welcome to community!

Try this:

  1. Take one if condition and pass the condition like this
strVariable.Contains("Value")

If yes - Then block will executes
if no - Else block will executes

Reference:

Contains

Reards,
NaNi

Hi,

How about the following expression?

image

var2.Split(" "c).All(Function(s) var1.Split(" "c).Contains(s))

Regards,

1 Like

It worked but can you explain this expression, thank you for your help

Hi,

var2.Split(" "c) returns string array which is split by space : “Stark” and “John”

All function returns True if all the items of var2.Split(" "c) : “Stark” and “John” is evaluated all True by inner expression.
The inner expression is var1.Split(" "c).Contains(s): it returns True if there is item of var2 in “My”,“name”,“is”,“John” and “Stark”.

As a result, this expression return True if “Stark” and “John” both exist in “My”,“name”,“is”,“John” and “Stark”.

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.