Remove all 0 batches from the string Header

Source: Internet
Author: User

CopyCodeThe Code is as follows: @ echo off
: Removes all 0 values from the string header.
::
For/F "delims = 0 tokens = *" % I in ("0009029") Do echo % I
Pause> NUL
Goto: EOF

@ Echo off
: Code by JM 2006-10-20 cmd @ XP
Set Var = 0002304500
: Intercept
Set Var = % var: * 0 = %
If "% var :~ 0, 1% "=" 0 "Goto intercept
Echo % var %
Pause

@ Echo off
: Removes all 0 values from the string header.
::
Set x = 00010280
Call: Sub % x %
Echo % Y %
Pause
Goto: EOF
: Sub
Set y = % 1
If "% Y :~ 0, 1% "=" 0 "Call: Sub % Y :~ 1%
Goto: EOF

@ Echo off
: Removes all 0 values from the string header.
: Set COUNT =-1 must use-1 instead of 0
::
Set num = 0003
Set COUNT =-1
Setlocal enabledelayedexpansion
: Loop
Set/A count + = 1
If "! Num :~ % Count %, 1! "=" 0 "Goto Loop
Echo! Num :~ % Count %!
Pause

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.