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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Get last 2 characters ...
Finance forum
Under review by Community Managers

Under review

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

Get last 2 characters of a string

Posted on by
Hi,
 
I have to get last 2 characters of a string using X++ code.
Eg: If my inputStr = 'QWERTY'
then i should get my outputStr = TY
 
I tried the below code but it doesn't seem to work, can someone help me 
        str InputString             = 'QWERTY';
        str OutputString          = subStr(warehouseString, (StrLen(InputString)-2), -2);
 
If my input string changes to POWER004 then my output string should be 04, can someone help me with the correct code.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans