Comparison of two string values

Hi
I want to compare two string values and check that if they are alphabetically arranged like - Moore and Kerr.
Please suggest

1 Like

Not sure I understand. So are you trying to verify that the string appears in the format “<Name 1> and <Name 2>” (where anything in angle brackets is a variable)?

Yeah!
There is a list of i.e ‘County’ and I have to sort the list and check if the sorting is done properly.
I am comparing first item of the list with last item and checking if firstitem > lastitem the result is pass.
I am not sure how to do that with Alphabets

list -
Baldwin
Bibb
Lawrence
Nome
Macon

@somya.sijaria Can you Show us an Example , What is the Input and What is the Expected Output?

If checking the two strings to check only they are arranged by alpha manner. Are we doing anything after chaecking this ?

You can easily arrange it by
YourList.sort() .

Between Can you explain your requirement please ?

open paranthesis to quteos to be answer

Please refer attached screenshot-
image

I have to automate to check if the sorting is working properly.

What I am doing for Integer type columns-

  1. Clicking on upside arrow
  2. Scrapping the data
  3. Comparing the firstitem and second item
  4. Passing the case if first value > last value.

But here I am stuck to check the sorting for alphabets.

Sorry * Comparing first and last item

  1. After Clicking the value. Get both first and last data and store it in array or list .
  2. Sort it by Array.Sort(arr) and then find the index of first data
    Array.IndexOf(array_name, “array element to search”).tostring

If the index is 0, It is alphabetically ordered else it is not

Hope it works and helps for you

3 Likes

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