Skip to content

Commit

Permalink
Submit: Release 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
datnguye committed Jan 17, 2021
1 parent 0c90fbe commit 9a05ead
Show file tree
Hide file tree
Showing 4 changed files with 4,574 additions and 33 deletions.
2 changes: 1 addition & 1 deletion MoneyToWords.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BEGIN
WHEN LOWER(@Lang)='lv' THEN dbo.MoneyToWords_LV(@Number)
WHEN LOWER(@Lang)='nl' THEN dbo.MoneyToWords_NL(@Number)
WHEN LOWER(@Lang)='no' THEN dbo.MoneyToWords_NO(@Number)
WHEN LOWER(@Lang)='pt' THEN dbo.MoneyToWords_PL(@Number)
WHEN LOWER(@Lang)='pl' THEN dbo.MoneyToWords_PL(@Number)
WHEN LOWER(@Lang)='pt' THEN dbo.MoneyToWords_PT(@Number)
WHEN LOWER(@Lang)='ru' THEN dbo.MoneyToWords_RU(@Number)
WHEN LOWER(@Lang)='sl' THEN dbo.MoneyToWords_SL(@Number)
Expand Down
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,40 @@ So by the end, it will do:


## Installaton
TBU

* Take the file /release/release_1_0.sql and compile into your database(s)
* Open new query, and run somes to make sure that it is working:
```
SELECT dbo.MoneyToWords(9999, 'ar')--Arabic (AR): تسعة آلَاف تسعة مِئَةٌ تسعة و تسعون
SELECT dbo.MoneyToWords(9999, 'cz')--Czech (CZ): devět tisíc devět set devadesát devět
SELECT dbo.MoneyToWords(9999, 'de')--German (DE): neuntausend neunhundertneunundneunzig
SELECT dbo.MoneyToWords(9999, 'dk')--Danish (DK): ni tusinde ni hundrede og nioghalvfems
SELECT dbo.MoneyToWords(9999, 'en')--English (EN): nine thousand nine hundred ninety-nine
SELECT dbo.MoneyToWords(9999, 'es')--Spanish (ES): nueve mil novecientos noventa y nueve
SELECT dbo.MoneyToWords(9999, 'fi')--Finnish (FI): yhdeksäntuhattayhdeksänsataayhdeksänkymmentäyhdeksän
SELECT dbo.MoneyToWords(9999, 'fr')--French (FR): neuf mille neuf cent quatre-vingt-dix-neuf
SELECT dbo.MoneyToWords(9999, 'ga')--Irish (GA): naoi míle naoi céad nócha a naoi
SELECT dbo.MoneyToWords(9999, 'he')--Hebrew (HE): תֵּשַׁע אֲלָפִים תֵּשַׁע מֵאוֹת תִּשְׁעִים וָתֵּשַׁע
SELECT dbo.MoneyToWords(9999, 'hi')--Hindi (HI): निन्यानवे हज़ार नौ सौ निन्यानवे
SELECT dbo.MoneyToWords(9999, 'id')--Indonesian (ID): sembilan ribu sembilan ratus sembilan puluh sembilan
SELECT dbo.MoneyToWords(9999, 'it')--Italian (IT): novemilanovecentonovantanove
SELECT dbo.MoneyToWords(9999, 'th')--Thai (TH): เก้าพันเก้าร้อยเก้าสิบเก้า
SELECT dbo.MoneyToWords(9999, 'ja')--Japanese (JA): 九千九百九十九
SELECT dbo.MoneyToWords(9999, 'ko')--Korean (KO): 구천구백구십구
SELECT dbo.MoneyToWords(9999, 'kz')--Kazakh (KZ): тоғыз мың тоғыз жүз тоқсан тоғыз
SELECT dbo.MoneyToWords(9999, 'lt')--Lithuanian (LT): devyni tūkstančiai devyni šimtai devyniasdešimt devyni
SELECT dbo.MoneyToWords(9999, 'lv')--Latvian (LV): deviņtūkstoši deviņsimt deviņdesmit deviņi
SELECT dbo.MoneyToWords(9999, 'nl')--Dutch (NL): negenduizendnegenhonderdnegenennegentig
SELECT dbo.MoneyToWords(9999, 'no')--Norwegian (NO): ni tusen ni hundre og nittini
SELECT dbo.MoneyToWords(9999, 'pl')--Polish (PL): dziewięć tysięcy dziewięćset dziewięćdziesiąt dziewięć
SELECT dbo.MoneyToWords(9999, 'pt')--Portuguese (PT): nove mil novecentos e noventa e nove
SELECT dbo.MoneyToWords(9999, 'ru')--Russian (RU): девять тысяч, девятьсот девяносто девять
SELECT dbo.MoneyToWords(9999, 'sl')--Slovene (SL): devet tisoč devetsto devetindevetdeset
SELECT dbo.MoneyToWords(9999, 'sr')--Serbian (SR): девет хиљада, деветсто деведесет и девет
SELECT dbo.MoneyToWords(9999, 'te')--Telugu (TE): తొంభై తొమ్మిది వేలు తొమ్మిది వందల తొంభై తొమ్మిది
SELECT dbo.MoneyToWords(9999, 'tr')--Turkish (TR): dokuz bin dokuz yüz doksan dokuz
SELECT dbo.MoneyToWords(9999, 'uk')--Ukrainian (UK): дев’ять тисяч, дев’ятсот дев’яносто дев’ять
SELECT dbo.MoneyToWords(9999, 'vi')--Vietnamese (VI): chín nghìn chín trăm chín mươi chín
```

## Contacts
Have a touch to us via emails: [Dat Nguyen](mailto:[email protected]), [Nam Vu](mailto:[email protected])
Expand Down
22 changes: 11 additions & 11 deletions core/MoneyToWords_FI.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ BEGIN
WHILE @vLoop > 0
BEGIN
IF @vDecimalNum % 10 = 0
SET @vSubDecimalResult = FORMATMESSAGE('%s %s', @ZeroWord, @vSubDecimalResult)
SET @vSubDecimalResult = FORMATMESSAGE(N'%s %s', @ZeroWord, @vSubDecimalResult)
ELSE
SELECT @vSubDecimalResult = FORMATMESSAGE('%s %s', Nam, @vSubDecimalResult)
SELECT @vSubDecimalResult = FORMATMESSAGE(N'%s %s', Nam, @vSubDecimalResult)
FROM @tDict
WHERE Num = @vDecimalNum%10

Expand All @@ -65,7 +65,7 @@ BEGIN
SET @vResult = @ZeroWord
ELSE
BEGIN
DECLARE @vSubResult NVARCHAR(MAX) = ''
DECLARE @vSubResult NVARCHAR(MAX) = N''
DECLARE @v000Num DECIMAL(15,0) = 0
DECLARE @v00Num DECIMAL(15,0) = 0
DECLARE @v0Num DECIMAL(15,0) = 0
Expand All @@ -91,15 +91,15 @@ BEGIN
BEGIN
-- greater than 20
SELECT @vSubResult = Nam FROM @tDict WHERE Num = @v0Num
SELECT @vSubResult = RTRIM(FORMATMESSAGE('%s%s', Nam, @vSubResult)) FROM @tDict WHERE Num = FLOOR(@v00Num/10)*10
SELECT @vSubResult = RTRIM(FORMATMESSAGE(N'%s%s', Nam, @vSubResult)) FROM @tDict WHERE Num = FLOOR(@v00Num/10)*10
END

--000
IF @v000Num > 99
IF @v000Num < 200
SET @vSubResult = FORMATMESSAGE('%s%s', @HundredWord, @vSubResult)
SET @vSubResult = FORMATMESSAGE(N'%s%s', @HundredWord, @vSubResult)
ELSE
SELECT @vSubResult = RTRIM(FORMATMESSAGE('%s%s%s', Nam, @HundredWords, @vSubResult))
SELECT @vSubResult = RTRIM(FORMATMESSAGE(N'%s%s%s', Nam, @HundredWords, @vSubResult))
FROM @tDict
WHERE Num = CONVERT(INT,@v000Num / 100)
END
Expand All @@ -110,17 +110,17 @@ BEGIN
IF @v000Num = 1 AND @vIndex = 1 AND @vPrev000Number % 1000 = 0
SET @vSubResult = N''

SET @vSubResult = FORMATMESSAGE('%s%s', @vSubResult, CASE
SET @vSubResult = FORMATMESSAGE(N'%s%s', @vSubResult, CASE
WHEN @vIndex=1 THEN CASE WHEN @v000Num > 1 THEN @ThousandWords ELSE @ThousandWord END
WHEN @vIndex=2 THEN CASE WHEN @v000Num > 1 THEN @MillionWords ELSE @MillionWord END
WHEN @vIndex=3 THEN CASE WHEN @v000Num > 1 THEN @BillionWords ELSE @BillionWord END
WHEN @vIndex=4 THEN CASE WHEN @v000Num > 1 THEN @TrillionWords ELSE @TrillionWord END
WHEN @vIndex>3 AND @vIndex%3=2 THEN (CASE WHEN @v000Num > 1 THEN @MillionWords ELSE @MillionWord END) + ' ' + TRIM(REPLICATE((CASE WHEN @v000Num > 1 THEN @BillionWords ELSE @BillionWord END) + ' ',@vIndex%3))
WHEN @vIndex>3 AND @vIndex%3=0 THEN TRIM(REPLICATE((CASE WHEN @v000Num > 1 THEN @BillionWords ELSE @BillionWord END) + ' ',@vIndex%3))
WHEN @vIndex>3 AND @vIndex%3=2 THEN (CASE WHEN @v000Num > 1 THEN @MillionWords ELSE @MillionWord END) + N' ' + TRIM(REPLICATE((CASE WHEN @v000Num > 1 THEN @BillionWords ELSE @BillionWord END) + N' ',@vIndex%3))
WHEN @vIndex>3 AND @vIndex%3=0 THEN TRIM(REPLICATE((CASE WHEN @v000Num > 1 THEN @BillionWords ELSE @BillionWord END) + N' ',@vIndex%3))
ELSE ''
END)

SET @vResult = FORMATMESSAGE('%s%s', LTRIM(@vSubResult), @vResult)
SET @vResult = FORMATMESSAGE(N'%s%s', LTRIM(@vSubResult), @vResult)
END

-- next 000 (to left)
Expand All @@ -130,7 +130,7 @@ BEGIN
END
END

SET @vResult = FORMATMESSAGE('%s %s', TRIM(@vResult), COALESCE(@DotWord + ' ' + NULLIF(@vSubDecimalResult,''), ''))
SET @vResult = FORMATMESSAGE(N'%s %s', TRIM(@vResult), COALESCE(@DotWord + N' ' + NULLIF(@vSubDecimalResult,N''), N''))

-- result
RETURN @vResult
Expand Down
Loading

0 comments on commit 9a05ead

Please sign in to comment.