Convert string decimal numbers to words in multiple languages.
NumberToWordsConverter
is a lightweight Go package that provides a simple and efficient way to convert string decimal number into their word representations. This package supports both Indonesian (id
) and English (en
) languages, allowing you to easily transform string decimal numbers into words.
To use the NumberToWordsConverter
library in your Go project, follow these steps:
- Install the package using
go get
:
go get github.com/sandisuryadi36/number-to-words
- Import the package in your Go code:
import "github.com/sandisuryadi36/number-to-words/convert"
package main
import (
"fmt"
"github.com/sandisuryadi36/number-to-words/convert"
)
func main() {
number := "12345.67"
language := "en"
words := convert.NumberToWords(number, language)
fmt.Println(words) // Output: "twelve thousand three hundred forty five point sixty-seven"
}
- Convert string decimal numbers to words in Indonesian (id) or English (en) languages.
- Handle decimal points.
- Handle high range number
convert.NumberToWords(numbers float64, lang string) string
Converts a string decimal number into its word representation in the specified language.
- numbers: The string decimal number to convert.
- lang: The language for word conversion ("id" for Indonesian or "en" for English).
- Returns: The word representation of the decimal number.
This project is licensed under the MIT License - see the LICENSE file for details.
Enjoy converting numbers to words with ease using the NumberWordsConverter library! If you encounter any issues or have suggestions, please feel free to open an issue or submit a pull request.
If you have any feedback, please reach out to us at [email protected]