Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


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