Convert Number into Ordinal
Hello Developers,
Here is the solution for converting the Number into Ordinal.
For Example:
This Idea can be used when lets say you are creating the Dashboard where you are showing upcoming celebrations like work Anniversary for you HRMS Application.
Once employee completes 1 year then it will show 1st Anniversary and say if completes 2 years the it will show 2nd Anniversary.
To Achieve this just create a custom function which take input as Number and Return String please find the deluge script for the same below.
- string getOrdinal(int n)
- {
- ord = "th";
- if (n % 10 == 1 && n % 100 != 11)
- {
- ord = "st";
- }
- else if (n % 10 == 2 && n % 100 != 12)
- {
- ord = "nd";
- }
- else if (n % 10 == 3 && n % 100 != 13)
- {
- ord = "rd";
- }
- return n + ord;
- }
Hope this helps!
Regards,
Anurag Jaiswal
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.