rem @echo off SETLOCAL ENABLEDELAYEDEXPANSION set k=speed_dao_mmr_20141016_300008588738_2200125875 call :PosLastChar %k% _ aa echo %aa% pause goto :eof rem :poschar str tag Res :PosChar set SubStr= set F=0 set TmpVar=%1 set %3=-1 :pos_begin set SubStr=!TmpVar:~%F%,1! if not defined substr goto :post_end if "%SubStr%"=="%2" ( set %3=%f% goto :post_end ) else ( set /a f=%f%+1 goto :pos_begin ) :post_end goto :eof rem :PosLastChar str tag Res :PosLastChar set SubStr= set F=0 set TmpVar=%1 set %3=-1 :PosLastCharBegin set SubStr=!TmpVar:~%F%,1! if not defined substr goto :PosLastCharEnd if "%SubStr%"=="%2" ( set %3=%f% set /a f=%f%+1 goto :PosLastCharBegin ) else ( set /a f=%f%+1 goto :PosLastCharBegin ) :PosLastCharEnd goto :eof
本文出自 “RZL_01的博客” 博客,请务必保留此出处http://rzl01.blog.51cto.com/3004337/1582872
原文地址:http://rzl01.blog.51cto.com/3004337/1582872