smcvey / tcz

The Chatting Zone Mud Server
GNU General Public License v2.0
6 stars 3 forks source link

Added @?formatnumber to add ,'s to output #11

Closed MattTheDev closed 4 years ago

MattTheDev commented 4 years ago

Had a need to format numbers on output with ,'s. Not a C programmer - you'll probably see that, but I wanted to take a stab at it, and see if it'd be helpful. Tested running locally.

Objective

Allow for {@?formatnumber "1234"} or {@?formatnumber 1234} to output with proper comma placement, ie: 1,234.

Code changes

doc/manual.txt - Doc Changes lib/generic.help.tcz - Doc Changes

include/externs.h - setup for @?formatnumber include/query_cmdtable.h - setup for @?formatnumber

src/stringutils.c - helper function implementation src/query.c - Actual implementation of @?formatnumber

noahmanderson commented 4 years ago

We talked about the further implications of this functionality and how it should probably work in the long run and we think that adding commas for the purposes of American currency are better solved in softcode commands. In the future a solution in the source code probably includes locales and other factors.