Search code examples
sharepointsharepoint-workflow

Compare two strings in sharepoint workflow 2013


Is it possible to compare two Strings in a 2013 sharepoint workflow?

e.g. in an If statement, If "Apple" less than "Banana" ...

Expected result is true: "Apple" is less than "Banana" (because "Apple" is alphabetically before "Banana")


Solution

    1. Create a String variable named alphabet and set the value aAbBcCdDeEfFgGhHiIgGkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ there. Please doublecheck if it fits English Alphabet because I learned it 27 years ago.

    2. Copy the first character from both of the Strings Apple and Banana into substrings.

    3. Use the action find Substring in String against both Substrings. Save the result to Integer variables String1index and String2index.

    4. Add usual condition If String1index is less than or equal to String2index