String Manipulation examples...
Posted: 13 Jun 2011 11:06
I apologize if this isn't the right place to ask these types of questions, but I was looking at the example here:
http://www.dostips.com/DtTipsStringMani ... .MapLookup
And I have a few questions about this part:
Q1: Why is set "Called" ?
Q2: What exactly is happening on these lines? What is the %% before map used for? I know that the : is used to modify the string being assigned, but what does the *%v%-=%% actually doing?
Q3: These questions are very acccurate examples of the holes in my batch scripting knowledge, can anyone point me towards a reference for more advanced techniques?
These questions came about because I am trying to understand the macro discussion and no matter how well documented, I seem to be missing some basic concepts. I examined some of the functions converted, and found my first problem, I didn't understand what was going on with the functions either. So I checked out the articles on this site, answered a few questions, but got stuck on the one above...
http://www.dostips.com/DtTipsStringMani ... .MapLookup
Code: Select all
REM ---- Example 1: Translate name of month into two digit number ----
SET v=Mai
SET map=Jan-01;Feb-02;Mar-03;Apr-04;Mai-05;Jun-06;Jul-07;Aug-08;Sep-09;Oct-10;Nov-11;Dec-12
CALL SET v=%%map:*%v%-=%%
ECHO.%v%
SET v=%v:;=&rem.%
And I have a few questions about this part:
Code: Select all
CALL SET v=%%map:*%v%-=%%
SET v=%v:;=&rem.%
Q1: Why is set "Called" ?
Q2: What exactly is happening on these lines? What is the %% before map used for? I know that the : is used to modify the string being assigned, but what does the *%v%-=%% actually doing?
Q3: These questions are very acccurate examples of the holes in my batch scripting knowledge, can anyone point me towards a reference for more advanced techniques?
These questions came about because I am trying to understand the macro discussion and no matter how well documented, I seem to be missing some basic concepts. I examined some of the functions converted, and found my first problem, I didn't understand what was going on with the functions either. So I checked out the articles on this site, answered a few questions, but got stuck on the one above...