Skip to content

Instantly share code, notes, and snippets.

@dyspop
Last active February 3, 2016 16:00
Show Gist options
  • Save dyspop/3705f22c9fc6fceff375 to your computer and use it in GitHub Desktop.
Save dyspop/3705f22c9fc6fceff375 to your computer and use it in GitHub Desktop.
Liquid zero start of string fill-ins.
{% assign user_code_str = event.user.user_code | downcase %}
{% capture user_code_length %}{{user_code_str | size}}{% endcapture %}
{% capture zeros_missing %}{{'9' | minus: user_code_length}}{% endcapture %}
{% capture nine_digit_user_code %}{% for zero in zeros_missing %}0{% endfor %}{{event.user.user_code}}{% endcapture %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment