Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] add string format support (modulo operator) #271

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

khchen
Copy link

@khchen khchen commented Jul 7, 2022

Sprintf or ruby's % operator for pocketlang.
Support following specifier: diuxXobfFeEgGcs. Example:

print("Number is %d" % 12)
print("Number is %d, type is %s" % [13, "cat"])
print("[%10s]" % "carrot")
print("[%-10s]" % "carrot")
print("Result is %.2f" % 12.3456)

Output:

Number is 12
Number is 13, type is cat
[    carrot]
[carrot    ]
Result is 12.35

@khchen khchen changed the title Add string format support (modulo operator) [Enhancement] add string format support (modulo operator) Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant