Int to string Conversion

xASU
New Member
3 0 0

Hi guys,

   Could anyone tell how can convert Int to string in dotliquid ?

 

Thank you.

0 Likes
Sebastian_Stoll
Shopify Partner
1 0 0

Number/int to string:

{% assign variablename = variablename | downcase %}

String to number:

{% assign variablename = variablename | plus:0 %}

SebastianStoll.com - Professional Shopify partner.
0 Likes
xASU
New Member
3 0 0

Thank you Sebastian.

Suppose, int Id = 1000, if i int Id convert to string , is it happens "1000" ?

0 Likes
Jason
Shopify Expert
10272 144 1943

Sidenote: Please don't use this method anymore. It's a legacy approach that's been replaced by a direct filter.

{% assign variablename = variablename | plus:0 %}

Use abs instead.

{% assign variablename = variablename | abs %}

 

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
xASU
New Member
3 0 0

Hi Jason,

    Thank you. Actually my problem is , i have a Int variable Suppose Id. Id is a incremental variable. This Id variable will append end of a string. then id variable increment continue. Lets see an example:

 {% assign Id = 1 %}

 {{ "Here is Id: " |   append: Id}} -----> So, id need to convert string

{% assign Id= Id | plus: 1 %}

 {{ "Here is Id: " |   append: Id}} -----> So,here  id need to convert also a string

This event will happen through a for loop.

Thank u again.

 

0 Likes