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
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.