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

feat : support nepali language #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sjdpk
Copy link

@sjdpk sjdpk commented Oct 5, 2023

No description provided.

@@ -0,0 +1,26 @@
class NepaliLangUtils {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please move this into ne.dart


for (int i = 0; i < numberString.length; i++) {
int digit = int.parse(numberString[i]);
result += nepaliDigits[digit];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we can use StringBuffer() instead of string concatenation to be efficient with memory

String numberString = num.toString();

for (int i = 0; i < numberString.length; i++) {
int digit = int.parse(numberString[i]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's minor optimization, but things can add up, I can not ensure any specific usage patterns from users so assuming a screen with multiple number inputs, when a language change occurs these calculations will add up.

I think alongside with the StringBuffer, we can use numberString.charCodeAt(i) - '0'.charCodeAt(0) would be faster to calculate digit index.

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.

None yet

2 participants