Skip to content

Add expression that gets the number of decimal places in a number #7948

Open
@graphicality

Description

@graphicality

Suggestion

I think that there definitely should be an expression to get the number of decimal places in a number.
For example:

on chat:
if message is "123.456":
set {_dec} to decimal places of (message parsed as number) # example syntax, returns integer for # places
if {_dec} is greater than 2:
send "Hey! We only use two decimal places around here!" to player
else: if {_dec} is less than or equal to 2:
send "Gooood boy! Proper decimal places!" to player

Why?

While you can do this with addons I believe, I see no reason as to why it shouldn't be included in the base version of Skript.
It simplifies code from multiple lines of splitting strings and parsing them yada yada to a simple expression.
Many ways of character counting and number formatting are already in Skript, why not round out the bases? (pun intended)

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.

Metadata

Metadata

Assignees

Labels

PR availableIssues which have a yet-to-be merged PR resolving itfeaturePull request adding a new feature.priority: lowest"Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions