Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Aug 2014
    Posts
    123
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Substringing with array variables

    Having a problem trying to manipulate strings.
    What I want goes like this:
    set m=1
    set ara[%m%]=X23456789x
    then
    set var=%ara[%m%]%
    set var=%%var%:~0,-2%YZ
    set ara[%m%]=%var%
    Of course this does not work. I have tried with the
    call command in different ways, without var, etc.
    Also with/without setlocal EnableDelayedExpansion.
    Cannot get it to work and have tried repeated
    tricks without luck. There must be a way to do this
    using a variable index in the array. Anyone know it?
    Seems so obvious but I can't see the solution.

  2. #2
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,202
    Thanks
    49
    Thanked 987 Times in 917 Posts
    Rob van der Woude always has an answer.
    http://www.robvanderwoude.com/battech_array.php

    cheers, Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •