Build forge command for replace or substring.
![]()
praveen patidar (86●2●35●44)
| asked Feb 22 '13, 1:38 a.m.
edited Feb 22 '13, 4:10 p.m. by Spencer Murata (2.3k●11●59●71)
Hello
Is there any way to do substring or replace of value of a variable in build forge? I need to truncate the last 5 characters of a variable in Build forge. I am running Project in Windows only. |
3 answers
![]()
There are no native substring commands for doing substrings in Build Forge, however I experimented on the Windows shell and found that this general command will do what you want:
.bset env "subVar=`echo %testVar:~0,5%`"
Where subVar is the first 5 characters of the variable. You will have to tweak it to remove the last 5 characters, but that should get you started.
~Spencer
|
![]()
This works but with the defualt value only. what I am doing is I am assigning a dynamic value using bset. Then I am echo the value. Then I do the command that you have mentioned but it printing "defau" means the default value only it is breaking from 0 to 5 characters.
Is there any Idea to make this thing work with dynamic value as well. # This works .bset env1 "testVar='`echo helloworld`' # this works and prints the helloworld echo $testVar # Your stuff .bset env "testVar2=`echo %testVar:0,5%`" # This prints the defau as the initial value of the testVar is default. echo $testVar2 Any idea on that ? |
![]()
What you are describing is .tset. The .bset command will only take affect after the current step, to affect the current step (and only the current step) you want .tset. So you would need to .tset testVar and then .bset testVar2, assuming you want the value of testVar2 to persist beyond this step and not testVar.
~Spencer |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.