It is currently June 25th, 2019, 6:32 am

String Stripping

Help with creating, editing & fixing problems with skins
ms310
Posts: 99
Joined: April 1st, 2015, 7:16 am

String Stripping

ms310 » April 24th, 2019, 7:13 am

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: 8308
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: String Stripping

balala » April 24th, 2019, 8:14 am

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: 99
Joined: April 1st, 2015, 7:16 am

Re: String Stripping

ms310 » April 26th, 2019, 1:08 am

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: 8308
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: String Stripping

balala » April 26th, 2019, 6:24 am

Did it help?