TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Delete the end of a val

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Cozen
Date: 2016-02-23
Time: 10:26

Delete the end of a val

Hi there,
Is it possible to delete the end of a value ?
Exemple :
[myVal;ope=deleteChar[1]] -> Delete one char from the end
Exemple :
[myVal;ope=deleteChar[2]] -> Delete two char from the end
Thanks.
By: Skrol29
Date: 2016-02-23
Time: 23:17

Re: Delete the end of a val

Hi,

It is not possible this way.
Can you give a snippet of your template to see if there is a workaround ?
By: Cozen
Date: 2016-02-24
Time: 10:25

Re: Delete the end of a val

I'm working in an HTML template and the php give me some values that I need to insert into the page.
I must modify the values in my HTML page.
In this exemple, I'm working with dates (real type is string) like '12 h 20 m' (val1 = '12 h' and val2 = '20 m').
I would like to format it to have an hour like '12' + ':' + '20'.
So I need to delete the end of the var if it's possible.
Thanks for the reply.
By: Skrol29
Date: 2016-02-25
Time: 01:02

Re: Delete the end of a val

You can try [myVal;ope=max:2].
This will keep only the 2 first characters.