WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Strings

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Adding a String of Numbers Together

Keywords: sum adding	

This sample shows how to use WIL to add variables together:

Say your data is already in a variable, called var1 and var2. The string of numbers below is delimited by a comma.

 var1="1,2,3"

 A=StrReplace(var1,",", "+")  ;Replaces your commas with + signs.

 B=%A%				  ;Forces the string to be added. 

 Message(A,B)			 ;Displays string and its sum.

 var2="3, 4, 5"

 C=StrReplace(var2,",", "+")

 D=%C%

 Message(C,D)

 Sum=%B% + %D%	     ;Concatenates sum of var1 with sum of var2

 Message("", Sum)	   ; shows string and resulting sum.

Article ID:   W13330
Filename:   Adding a String of Numbers Together.txt
File Created: 1999:04:15:16:53:18
Last Updated: 1999:04:15:16:53:18