It is currently April 25th, 2024, 3:24 pm

String Stripping

Get help with creating, editing & fixing problems with skins
ms310
Posts: 225
Joined: April 1st, 2015, 7:16 am

String Stripping

Post by ms310 »

I am having quite a time doing something simple - I have a string with three values in it separated by commas in a String Meter - I want to strip away the first comma and everything after it.

String Value is Nagoya, 23, Japan

Code: Select all

[WeatherLocation]
Group=Weather
Meter=String
MeterStyle=MeterStyleText
MeasureName=MeasureWeatherLocation
RegExpSubstitute=1
Substitute=([^,]+)
X=[WeatherTemperature:X]
DynamicVariables=1
Result: Nagoya, 23, Japan

Desired Result: Nagoya

Thanks for your help with this simple, simple problem.
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: String Stripping

Post by balala »

ms310 wrote: April 24th, 2019, 7:13 am Result: Nagoya, 23, Japan

Desired Result: Nagoya
There is no way to use a substitution on meters. They can be used ONLY on measures. So, move the RegExpSubstitute and the Substitute options to the [MeasureWeatherLocation] measure.
Besides this, the Substitute is wrong as you've written it. Try the following one: Substitute="^(.*), (.*), (.*)$":"\1".
ms310
Posts: 225
Joined: April 1st, 2015, 7:16 am

Re: String Stripping

Post by ms310 »

balala wrote: April 24th, 2019, 8:14 am There is no way to use a substitution on meters. They can be used ONLY on measures. So, move the RegExpSubstitute and the Substitute options to the [MeasureWeatherLocation] measure.
Besides this, the Substitute is wrong as you've written it. Try the following one: Substitute="^(.*), (.*), (.*)$":"\1".
Sorry for my delayed response. Thank you very much.
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: String Stripping

Post by balala »

Did it help?