N'th: Difference between revisions

70 bytes added ,  11 months ago
→‎{{header|Batch File}}: Use if...... else if
(→‎{{header|PowerShell}}: Fixed 11th, 112th and 13th)
(→‎{{header|Batch File}}: Use if...... else if)
Line 927:
for /l %%n in (%~1,1,%~2) do (
set curr_num=%%n
if !curr_num:~-2!==11 (set "out=%%nth"
) else if !curr_num:~-12!==112 (set "out=%%nstnth")
) else if !curr_num:~-12!==213 (set "out=%%nndnth")
) else if !curr_num:~-1!==31 (set "out=%%nrdnst")
) else if !curr_num:~-21!==112 (set "out=%%nthnnd")
) else if !curr_num:~-21!==123 (set "out=%%nthnrd")
if) else !curr_num:~-2!==13 (set "out=%%nth")
set "range_output=!range_output! !out!"
)
3,038

edits