web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Removing leading and ending spaces from a string field

(0) ShareShare
ReportReport
Posted on by 390

Hey team,

I have a scenario in which I have a simple list form with various fields like firstname,lastname etc. Now I want to just remove spaces from the start and end of the FirstName and LastName. Eg: The name of an employee is Amaia Scott Delany. So, the FirstName is "Amaia" and Last Name is "Scott Delany" if the user is entering the FirstName as "  Amaia " and Last Name as "  Scott Delany". In this case I just want to trim the spaces from the start and and the end so it should save it in this way, FirstName: "Amaia" and LastName: "Scott Delany". The space between "Scott" and "Delany" should be maintained. Please can you help me achieve this using x++. 

I have the same question (0)
  • WillWU Profile Picture
    22,363 on at

    Hi SKD,

    Are all of your names delimited by the first space between the firstname and lastname?

    Please check the strScan method:docs.microsoft.com/.../xpp-string-run-time-functions

    It will return the first occurrence of the text string mentioned in the parameters.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    You can use strLTrim and strRTrim functions: docs.microsoft.com/.../xpp-string-run-time-functions

  • Suggested answer
    PA-22040759-0 Profile Picture
    6,194 on at

    Or StrLRTrim from the Global class

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 763 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 284 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans