Here is a more detailed example of Seagate Crystal Reports' string processing capabilities. The Caesar cipher is a simple code that is traditionally credited to Julius Caesar. In this code, each letter of a word is replaced by a letter five characters further in the alphabet. For example, "Jaws" becomes "Ofbx". Notice that "w" is replaced by "b". Since there are not 5 characters after "w" in the alphabet, it starts again from the beginning.
Here is a formula that implements applying the Caesar cipher to the field {Customer.Customer Name} in the Xtreme database:
Dim inString 'The input string to encrypt inString = {Customer.Customer Name} Dim shift shift = 5
Dim i For i = 1 To Len(inString) Dim inC, outC inC = Mid(inString, i, 1) Dim isChar, isUCaseChar isChar = LCase(inC) In "a" To "z" isUCaseChar = isChar And (UCase (inC) = inC)
If isChar Then Dim offset offset = (Asc(inC) + shift - Asc("a")) Mod _ (Asc("z") - Asc("a") + 1) outC = Chr(offset + Asc("a")) If isUCaseChar Then outC = UCase(outC) Else outC = inC End If formula = formula & outC Next i
In the above example, there is a multi
Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com |