Ankit2
(Ankit)
October 27, 2023, 2:25am
1
HELP,
i want to find if two input string are cipher of each other or not ?
inputstring 1 - “listen”
inputstring 2 - “silent”
so this both strings are cipher of each other ( so if we rearange the string 1 it becomes “silent” and vice versa
inputstring 1 - “hello”
inputstring 2 - “world”
and this strings are not cipher
so how to code that im confused.
Yoichi
(Yoichi)
October 27, 2023, 2:31am
2
Hi,
Do you mean anagram?
If so, the following will help you.
String.Concat(str1.OrderBy(Function(c) c))=String.Concat(str2.OrderBy(Function(c) c))
Regards.
1 Like
Parvathy
(PS Parvathy)
October 27, 2023, 2:33am
3
Hi @Ankit2
Try this
Str1="Silent"
Str2="Listen"
Anagram=String.Join("", str1.ToLower().OrderBy(Function(c) c)).Equals(String.Join("", str2.ToLower().OrderBy(Function(c) c)))
If
Anagram
Then
Log Message: Both strings are cipher to each other
Else
Log Message: Both Strings are not cipher to each other
Hope it helps
1 Like
Ankit2
(Ankit)
October 27, 2023, 2:54am
4
Thank you so much It worked
1 Like
system
(system)
Closed
October 30, 2023, 2:54am
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.