Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8411753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:30:18+00:00 2026-06-10T00:30:18+00:00

I create the function to convert the Currency to Word Format but my problem

  • 0

I create the function to convert the Currency to Word Format but my problem is that when put the textfeild value 100000 i need Indian Format one lakh,but it give me one hundred thousand so any solution for that.

 NSString *str1 = txtAmount.text;
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setNumberStyle: NSNumberFormatterSpellOutStyle];

    NSString *localeStr = [appDel.countryCodeDict valueForKey:appDel.selectedCountry];


    if ([appDel.selectedCountry isEqualToString:@"France"]) {
        localeStr = @"fr";
    }
    if ([appDel.selectedCountry isEqualToString:@"Germany"]) {
        localeStr = @"de";
    }


    NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:localeStr];
    [formatter setLocale:usLocale];  

    [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];

    [formatter setNumberStyle:NSNumberFormatterCurrencyStyle];


    NSArray *valueArr=[str1 componentsSeparatedByString:@"."];


    [formatter setNumberStyle: NSNumberFormatterSpellOutStyle];

    NSString *firstStr = [valueArr objectAtIndex:0];
    NSString *seconfStr = [valueArr lastObject];           

    if (valueArr.count==2 && ![seconfStr isEqualToString:@""]) {
        double firstAmt = [firstStr doubleValue];
        NSString *convertStr = [formatter stringFromNumber:[NSNumber numberWithDouble:firstAmt]];

        double secondAmt = [seconfStr doubleValue];
        NSString *convertStr1 = [formatter stringFromNumber:[NSNumber numberWithDouble:secondAmt]];

        NSString *finalStr = [convertStr stringByAppendingFormat:@" %@ %@ %@",appDel.firstCurrencystr,convertStr1,appDel.secondCurrencystr];
        NSLog(@"%@",finalStr);
        NSString *firstCapChar = [[finalStr substringToIndex:1] capitalizedString];

        tempStr = [finalStr stringByReplacingCharactersInRange:NSMakeRange(0,1) withString:firstCapChar];

    }else{

        double firstAmt = [firstStr doubleValue];
        NSString *convertStr = [formatter stringFromNumber:[NSNumber numberWithDouble:firstAmt]];
        convertStr = [convertStr stringByAppendingFormat:@" %@",appDel.firstCurrencystr];
        NSString *firstCapChar = [[convertStr substringToIndex:1] capitalizedString];
        tempStr = [convertStr stringByReplacingCharactersInRange:NSMakeRange(0,1) withString:firstCapChar];

    }

    appDel.lblAmountView.lblAmount.text = tempStr;

Any idea of that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:30:19+00:00Added an answer on June 10, 2026 at 12:30 am
    at last i convert the hole currency in lakh and crore format of india:
    
    
    
    -(NSString *)stringfromNumberIndia:(NSString *)str_word
        {
            NSString *tempStr=@"";
    
            NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
            [formatter setNumberStyle: NSNumberFormatterSpellOutStyle];
    
            NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_IN"];
            [formatter setLocale:usLocale];
            [formatter setNumberStyle: NSNumberFormatterSpellOutStyle];
    
    
            if ([str_word length]>5) {
    
                NSString* str_convert = [str_word substringFromIndex:[str_word length]-5];
                NSString* str_convert1 = [str_word substringToIndex:[str_word length]-5];
                NSLog(@"str :%@",str_convert);
                NSLog(@"str1 :%@",str_convert1);
                tempStr = [[self stringfromNumberIndia:str_convert] stringByAppendingString:tempStr];
                int l=[str_convert1 length];
                 for (int i=0; i<l;) {
    
                    NSRange range;
                    if (l>2 && i == 0) {
                        range=NSMakeRange(l-i-2, 2);
                    }
                    else{
                        range=NSMakeRange(0, l-i);
                    }
                    NSString *str_first=[str_convert1 substringWithRange:range];
                     if ([str_first intValue] == 0) {
                         if (i == 0)
                             i+=2;
                         else
                             break;
                         continue;
                    }
                    NSLog(@"str_first:%@",str_first);
                    if (i== 0) {
                        str_first=[formatter stringFromNumber:[NSNumber numberWithDouble:[str_first doubleValue]]];
                        str_first = [str_first stringByAppendingFormat:@" lakh "];
                        tempStr = [str_first stringByAppendingString:tempStr];
                    }
                    else {
                        str_first =[self stringfromNumberIndia:str_first];
                        str_first = [str_first stringByAppendingFormat:@" crore "];
                        tempStr = [str_first stringByAppendingString:tempStr];
                        break;
                    }
                     i+=2;
                }
            }
            else if ([str_word intValue] !=0){
                double Amt = [str_word doubleValue];
                NSString *convertStr = [formatter stringFromNumber:[NSNumber numberWithDouble:Amt]];
    
                NSString *firstCapChar = [convertStr substringToIndex:1];
                tempStr = [convertStr stringByReplacingCharactersInRange:NSMakeRange(0,1) withString:firstCapChar];
            }
            return  tempStr;
    
        }
    

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a function that can convert a month number to
It's possible to call C functions through CREATE FUNCTION but how can .NET functions
I am new to Prolog and I'm trying to to create function that will
I'm trying to create a user defined function in Oracle that will return a
I need to create a function pointer file. I am using perl for the
I have two awesome strings: my_awesome_string my_awesomestring I'm trying to create a function that
So I need an SQL function that will concatenate a bunch of row values
I have a conception problem on my ConverterManager. ConverterManager is an object that convert
I wrote a SQL function to convert a datetime value in SQL to a
I am trying to create a function to convert a mapped drive path to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.