Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Spelling a number in Spanish

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Spelling a number in Spanish

    Attached is a converter to spell a number in Spanish. This is from an Access routine written in VB.

    Code:
    'Date Created: 13-Jan-2008 12:01:34 AM
    'Last Updated: 17-Jan-2008 01:28:12 PM
    'Created By  : Bill Parker
    'Updated By  : Bill Parker
    FUNCTION currency_to_spanish AS C (number AS N )
    'DESCRIPTION:Convert a money field to words for printing on a check.
    'original code written by Joe Foster to output English text in MS Access.
    'output always includes xx/100, except where number = 0.
    'handles negatives and numbers to trillions.
    'some comments are from the original VB code, some are the English of what is now Spanish.
    
    N = number
    
    'Function English (ByVal N As Currency) As String
        Constant Thousand = 1000
        Constant Million = Thousand * Thousand
        Constant Billion = Thousand * Million
        Constant Trillion = Thousand * Billion
    
        If N = 0 
        	currency_to_spanish = "cero"	'"zero"
        	Exit Function
        end if
    
        Dim Buf As C	'String
        If N < 0
        	Buf = "negativo "	'"negative " 
        Else 
        	Buf = ""
        end if
    
        Dim Frac As N	'Currency: 
        Frac = Abs(N - int(N))
        Frac = round(Frac,2)
        If N < 0 .Or. Frac <> 0
        	N = Abs(int(N))
        end if
    
        Dim AtLeastOne As L=.f.	'Integer: 
        if N >= 1
    	    AtLeastOne = .t.
        end if
    
        If (N >= Trillion) Then
            prefix = DigitGroup(Int(N / Trillion))
            if prefix = "uno" then; prefix = "un"; end if	'Spanish idiom
            Buf = Buf + prefix + " trillon"	'" trillion"
            N = N - Int(N / Trillion) * Trillion ' Mod overflows in Access
            If N >= 1
            	Buf = Buf + " "
            end if
        End If
        
        If (N >= Billion) Then
            prefix = DigitGroup(Int(N / Billion))
            if prefix = "uno" then; prefix = "un"; end if	'Spanish idiom
            Buf = Buf + prefix + " billon"	'" billion"
            N = N - Int(N / Billion) * Billion ' Mod still overflows
            If (N >= 1) Then 
            	Buf = Buf + " "
            end if
        End If
    
        If (N >= Million) Then
            prefix = DigitGroup(N / Million)
            if prefix = "uno" then; prefix = "un"; end if	'Spanish idiom
            Buf = Buf + prefix + " millon"	'" million"
            N = mod(N, Million)
            If (N >= 1) Then 
            	Buf = Buf + " "
            end if
        End If
    
        If (N >= Thousand) Then
            prefix = DigitGroup(N / Thousand)
            if prefix = "uno" then; prefix = "un"; end if	'Spanish idiom
            Buf = Buf + prefix + " mil"	'" thousand"
            N = mod(N, Thousand)
            If (N >= 1) Then 
            	Buf = Buf + " "
            end if
        End If
    
        If (N >= 1) Then
            lessthan1000 = DigitGroup(N)
            if lessthan1000 = "ciento" then; lessthan1000 = "cien"; end if	'Spanish idiom
            Buf = Buf + lessthan1000
        End If
    
        If (Frac = 0) Then
            Buf = Buf + " con 00/100"	'" exactly"
        ElseIf (Int(Frac * 100) = Frac * 100) Then
            If AtLeastOne Then 
            	Buf = Buf + " con "	'" and "
            	Buf = Buf + right("00" +alltrim(str(Frac*100)),2) +"/100"	'Format$(Frac * 100, "00") + "/100"
            end if
        Else
            If AtLeastOne Then 
            	Buf = Buf + " and "
            	Buf = Buf + Format$(Frac * 10000, "0000") + "/10000"
            end if
        End If
    
        currency_to_spanish = Buf
    End Function
    
    
    '------------------------------------------------------------------------
    Function DigitGroup as C (N As N)
        Constant Hundred = "cientos"	'(add exception for 100 in calling routine)
        Constant One = "uno"
        Constant Two = "dos"
        Constant Three = "tres"
        Constant Four = "cuatro"
        Constant Five = "cinco"
        Constant Six = "seis"
        Constant Seven = "siete"
        Constant Eight = "ocho"
        Constant Nine = "nueve"
        Dim Buf As C = ""	'String: Buf = ""
        Dim Flag As L = .f.	'Integer: Flag = False
    
        'Do hundreds
        'there are three exceptions in Spanish
        int_N = int(N / 100)
        Select 
    	    Case int_N = 0; Buf = "";  Flag = .F.
    	    Case int_N = 1; Buf = "ciento"; Flag = .T.	'One + Hundred; Flag = .T.
    	    Case int_N = 2; Buf = Two + Hundred; Flag = .T.
    	    Case int_N = 3; Buf = Three + Hundred; Flag = .T.
    	    Case int_N = 4; Buf = Four + Hundred; Flag = .T.
    	    Case int_N = 5; Buf = "quinientos"; Flag = .T.	'Five + Hundred; Flag = .T.
    	    Case int_N = 6; Buf = Six + Hundred; Flag = .T.
    	    Case int_N = 7; Buf = Seven + Hundred; Flag = .T.
    	    Case int_N = 8; Buf = Eight + Hundred; Flag = .T.
    	    Case int_N = 9; Buf = "novecientos"; Flag = .T.	'Nine + Hundred; Flag = .T.
        End Select
       
        If (Flag <> .F.) Then 
        	N = mod(N,100)
        end if
        If (N > 0) Then
            If (Flag <> .F.) Then; Buf = Buf + " ";end if
        Else
            DigitGroup = Buf
            Exit Function
        End If
          
        'Do tens (except teens)
        int_N = int(N / 10)
        Select
        Case int_N = 0; Flag = .F.
        Case int_N = 1; Flag = .F.
        Case int_N = 2; Buf = Buf + "veinte"; Flag = .T.	'"twenty"; Flag = .T.
        Case int_N = 3; Buf = Buf + "treinta"; Flag = .T.	'"thirty"; Flag = .T.
        Case int_N = 4; Buf = Buf + "cuarta"; Flag = .T.	'"forty"; Flag = .T.
        Case int_N = 5; Buf = Buf + "cincuenta"; Flag = .T.	'"fifty"; Flag = .T.
        Case int_N = 6; Buf = Buf + "sesenta"; Flag = .T.	'"sixty"; Flag = .T.
        Case int_N = 7; Buf = Buf + "seteta"; Flag = .T.	'"seventy"; Flag = .T.
        Case int_N = 8; Buf = Buf + "ochenta"; Flag = .T.	'"eighty"; Flag = .T.
        Case int_N = 9; Buf = Buf + "noventa"; Flag = .T.	'"ninety"; Flag = .T.
        End Select
    
        If (Flag <> .F.) Then 
        	N = mod(N,10)
        end if
        If (N > 0) Then
            'If (Flag <> .F.) Then; Buf = Buf + "-";end if
            If (Flag <> .F.) Then
            	if word(Buf,-1) = "veinte"	' Spanish idiom
            		'add nothing in this case, e.g. veinteuno
            	else
            		Buf = Buf + " y "
            	end if
            end if
        Else
            DigitGroup = Buf
            Exit Function
        End If
        
        'Do ones and teens
        int_N = int(N)
        Select
        Case int_N = 0; ' do nothing
        Case int_N = 1; Buf = Buf + One
        Case int_N = 2; Buf = Buf + Two
        Case int_N = 3; Buf = Buf + Three
        Case int_N = 4; Buf = Buf + Four
        Case int_N = 5; Buf = Buf + Five
        Case int_N = 6; Buf = Buf + Six
        Case int_N = 7; Buf = Buf + Seven
        Case int_N = 8; Buf = Buf + Eight
        Case int_N = 9; Buf = Buf + Nine
        Case int_N = 10; Buf = Buf + "diez"	'"ten"
        Case int_N = 11; Buf = Buf + "once"	'"eleven"
        Case int_N = 12; Buf = Buf + "doce"	'"twelve"
        Case int_N = 13; Buf = Buf + "trece"	'"thirteen"
        Case int_N = 14; Buf = Buf + "catorce"	'"fourteen"
        Case int_N = 15; Buf = Buf + "quince"	'"fifteen"
        Case int_N = 16; Buf = Buf + "dieciseis"	'"sixteen"
        Case int_N = 17; Buf = Buf + "diecisiete"	'"seventeen"
        Case int_N = 18; Buf = Buf + "dieciocho"	'"eighteen"
        Case int_N = 19; Buf = Buf + "diecinueve"	'"nineteen"
        End Select
    
        DigitGroup = Buf
    End Function
    ?currency_to_spanish(1122344.55)
    = "un millon ciento veintedos mil trescientos cuarta y cuatro con 55/100"

    Bill.

    #2
    Re: Spelling a number in Spanish

    Attached is an updated version. Fixes some incorrect Spanish idioms. Also adds an optional parameter for number of decimal places, and therefore makes the function name more generic.

    ?number_to_spanish(123.456,3)
    = "ciento veintitres con 456/1000"

    Bill.

    Comment


      #3
      Anybody have this in English?

      Thanks

      Comment


        #4
        Why not look at the code above and adapt it to English yourself. Or just use the built in Alpha formatting options to show text for numbers.

        Comment

        Working...
        X