Strip String - How to
#1
What is the best way to strip a sting with a particular character. Kodi database shows multiple country seperated by forward slash
United Kingdom / United States of America

I wanted to get only the first country into the variable . Any help will be appreciated

Enigma
Reply
#2
Look at...

https://github.com/marcelveldt/script.sk...wiki/Tools

...under Strip String
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#3
Thanks for this manfeed. Since i am novice to the programming, can you please help me how i can get this into a variable. I have tried the below

<variable name="CountryNewVar">
RunScript(script.skin.helper.service,action=stripstring,splitchar=/,string=$INFO[ListItem.Country],output=CountryNew)
<value>$INFO[CountryNew]</value>
</variable>

But i am not getting anything on the variable. Do i need to load skin helper service on the xml?
Reply
#4
I wanted to show the country details in includes.xml file but wanted the first country to show from $INFO[ListItem.Country if there are multiple countries, Appreciate your help
Reply
#5
(2017-08-04, 22:34)enigmaa Wrote: Thanks for this manfeed. Since i am novice to the programming, can you please help me how i can get this into a variable. I have tried the below

<variable name="CountryNewVar">
RunScript(script.skin.helper.service,action=stripstring,splitchar=/,string=$INFO[ListItem.Country],output=CountryNew)
<value>$INFO[CountryNew]</value>
</variable>

But i am not getting anything on the variable. Do i need to load skin helper service on the xml?

Without having looked at the actual skin helper part, a variable is basically constructed as follows:

<variable name="Name">
<value condition="ConditionToBeTrue">WhatToDoWhenTrue</value>
<value>WhenToDoWhenNotTrue</value>
</variable>

$INFO[CountryNew] is not a valid infolabel, you can't make these up yourself. Includes.xml is different for every skin,
Reply
#6
Thanks Jeroen. The stripstring example shows
-----------------------------------------------------------------------
RunScript(script.skin.helper.service,action=stripstring,splitchar=.,string=$INFO[System.BuildVersion],output=kodiversion_main)

The above command will take the Kodi Buildversion Info string and split it on the "." character. The result is the main Kodi version, e.g. "16" or "17". You can access the result in your skin as a window property, in the above example kodiversion_main: $INFO[kodiversion_main)]
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

I wanted the stripped string to be accessible as a variable so that the output can be shown in include.xml. I have Estuary skin and i wanted some changes on the default skin to show some extra details. The current $INFO[ListItem.Country] will have sometime more that one country and i wanted to just show the first one. Each country is seperated by "/"
Reply

Logout Mark Read Team Forum Stats Members Help
Strip String - How to0