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

Announcements

No record found.

News and Announcements icon
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,172 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

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 609 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 561

#3
CP04-islander Profile Picture

CP04-islander 383

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans