It is currently April 27th, 2024, 11:55 am

Number Format Question

Get help with creating, editing & fixing problems with skins
Lars
Posts: 5
Joined: January 6th, 2024, 2:56 pm

Number Format Question

Post by Lars »

Hi all,

sorry for this question, but i did not find anything related...

I have a variable / String which is formated like this: 10000.00
How do i do a number format to convert it into european currency format like this 10.000,00 ?

Many thanks for your help and all the best,

Lars
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: Number Format Question

Post by CarlotaN »

Sorry but I'm very new, have you tried adding this line below the result?

Code: Select all

Substitute="0000.00":"0.000,00"
That's all I can think of
Image
Lars
Posts: 5
Joined: January 6th, 2024, 2:56 pm

Re: Number Format Question

Post by Lars »

Thanks for your answer, but it's not working :-)
Maybe another idea?

Thanks and all the best
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: Number Format Question

Post by CarlotaN »

Wait for a guru, there are many here and surely someone is already studying the best answer.
Image
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Number Format Question

Post by Yincognito »

Lars wrote: February 25th, 2024, 9:21 am Hi all,

sorry for this question, but i did not find anything related...

I have a variable / String which is formated like this: 10000.00
How do i do a number format to convert it into european currency format like this 10.000,00 ?

Many thanks for your help and all the best,

Lars
CarlotaN was close earlier, you'd typically do it in a Substitute option, though it's a bit more complex than the previous advice. It can be done using Lua too, with the approach similarly "special". I wrote solutions for both approaches and could post them when I'm back to my laptop, but if you don't want to wait, you can check this thread, since my variants are more or less along the same lines:
https://forum.rainmeter.net/viewtopic.php?t=17379
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Number Format Question

Post by Yincognito »

Lars wrote: February 25th, 2024, 9:21 amI have a variable / String which is formated like this: 10000.00
How do i do a number format to convert it into european currency format like this 10.000,00 ?
As promised, here's the Substitute way (it involves regular expressions):

Code: Select all

[Variables]
Value=10000.00
ThousandsSeparator="."
DecimalsSeparator=","

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,255

---Measures---

[Text]
Measure=String
String=#Value#
RegExpSubstitute=1
Substitute="(?<=\d)\.":"#DecimalsSeparator#","^([\-\+]?\d+)$":"\1#DecimalsSeparator#","(\d)(?=(?:\d{3})+\#DecimalsSeparator#)":"\1#ThousandsSeparator#","\#DecimalsSeparator#$":""

---Meters---

[Result]
Meter=String
FontFace=Consolas
FontSize=16
FontColor=255,255,255,255
AntiAlias=1
MeasureName=Text
Text=Result = %1
DynamicVariables=1
Using variables is not mandatory, of course - you can replace them with the actual values or symbols you want to use as separators.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Lars
Posts: 5
Joined: January 6th, 2024, 2:56 pm

Re: Number Format Question

Post by Lars »

Thank you :-)
That's exactly what i am looking for...
Many thanks :-)
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Number Format Question

Post by Yincognito »

Lars wrote: February 27th, 2024, 8:03 am Thank you :-)
That's exactly what i am looking for...
Many thanks :-)
You're welcome - glad I could help. :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth