Forum Discussion

brycedwhite's avatar
brycedwhite
Frequent Visitor
4 years ago
Solved

Test.StartsWith any letter

I need help with using Text.Starts with.  I want to test the first character of a string.  If it is any capital letter (A..Z) then return "Letter", if it starts with a "1" then return "It's a 1" else "Not a letter or a 1".  I can't figure out how to test for the first case (A..Z).

Any help would be appreciated!

  • Use following (replace Column1 appropriately)

    if List.Contains({"A".."Z"},Text.Start([Column1],1)) then "Letter" 
    else if Text.Start([Column1],1)="1" then "It's a 1" 
    else "Not a letter or a 1"

2 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    Use following (replace Column1 appropriately)

    if List.Contains({"A".."Z"},Text.Start([Column1],1)) then "Letter" 
    else if Text.Start([Column1],1)="1" then "It's a 1" 
    else "Not a letter or a 1"