Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Answered

Comparing string ignoring spaces

Posted on by 143
I have a filter function for a collection
Filter(
    testlist,
    DestDistrict = Trim(varcurrentitem.SourceDistrict)
)
 
the problem i have is the DestDistrict has an extra space in between values like 
 
Wes t Virgini A 
 
now the source district has 
West Virginia
 
how do compare these two values ignoring the spaces in-between or leading
I just want to match the characters only. 
WestVirginia= WestVirginia
 
 
  • ronaldwalcott Profile Picture
    ronaldwalcott 1,026 on at
    Comparing string ignoring spaces
    For efficiency you could use a With and something like 
     
    With({_stringToCheck:Substitute(Trim(varcurrentitem.SourceDistrict), " ", "")},
    Filter(
        testlist,
        Substitute(DestDistrict, " ", "") = stringToCheck
    ))
     
    and remember delegation issues may occur depending on the collection size 
  • Verified answer
    SaiRT14 Profile Picture
    SaiRT14 1,278 on at
    Comparing string ignoring spaces
    try  modify your Filter function:
    Filter(
        testlist,
        Substitute(DestDistrict, " ", "") = Substitute(Trim(varcurrentitem.SourceDistrict), " ", "")
    )
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard