Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use batch processing to remove all zeros from the string header

Shulou Source: shulou.com Published: 2022-06-03 08:15:27 11月15日 Update

This article mainly introduces how to use batch processing to remove all the zeros at the head of the string, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

The code is as follows:

@ echo off:: remove all 0:: 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:: remove all 0: set x00010280 call: sub% x% echo% Y% pause goto: EOF: sub set yous% 1 if "% y count+=1 if 0 count+=1 if 1" = = "0" call: sub% yvision 1% goto: EOF@echo off:: remove all 0:: set count=-1 from the string header 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! Numlux% count%! Pause thank you for reading this article carefully. I hope the article "how to use batch processing to remove all zeros at the beginning of a string" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Characters strings articles code value interest at the same time more friends knowledge editing industry information information channels channels references learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi OPPO Reno macOS Microsoft