Skip to content

Allow % formating like in C like languages or fstring like python #81

@gekkowrld

Description

@gekkowrld

Describe the feature

C like languages allow the user to "manipulate" strings using '%' e.g "%s" for strings, "%d" for decimals and so on. Python also has the same feature using .format() and f-strings.

Use Case

andika() currently only supports arbitrary number of arguments but no way of organizing them as per user needs.

Adding this will enable the user to do like:

fanya i = 0

fanya jina = jaza("Unaitwa nani rafiki? ")

wakati (i <= 5) {
		andika("Rafiki %s hii ni %d", jina, i)
		i++
}

(the same case with f-strings)

Proposed Solution

The golang and or python implementation details can be of use:

This are previous implementation details, not all the formatting will be copied over.

Other Information

No response

Acknowledgements

  • This feature might incur a breaking change
  • I may be able to implement this feature request

Version used

v0.5.1 (compiled from source with modifications from #80)

Environment details (OS name and version, etc.)

GO VERSION: go version go1.22.1 linux/amd64
Kernel: 6.8.1-arch1-1
Shell: Bash
OS: Arch Linux x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions