Articles → UIPATH → Check If The String Is Palindrome Or Not In Uipath

Check If The String Is Palindrome Or Not In Uipath






Implementation




  1. Create a variable "MainString" that needs to be checked for palindrome
  2. Create a character array "inputCharArray"
  3. Picture showing the MainString and inputCharArray variables in variables window
    Click to Enlarge

  4. Drag and drop the "Assign" activity and set the value of the "inputCharArray" variable to "MainString.ToCharArray()"
  5. Picture showing assigning the value to variable inputCharArray using the Assign activity
    Click to Enlarge

  6. Drag and drop the "Invoke Code" activity and write the code to reverse the string. In the "Invoke Code" activity, pass one parameter "input" of type In/Out
  7. Picture showing argument window of the Invoke Code activity
    Click to Enlarge

  8. Drag and drop the "If" activity to check if the original and reversed string is the same or not. If the strings are the same then the string is palindrome
  9. Picture showing the if activity to check if string is palindrome or not
    Click to Enlarge

  10. Save and run the bot

Output


Picture showing the message box when the string is palindrome
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, March 15, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250