OpenNTF.org - DebugStr function - translate
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
DebugStr function - translate the value of a variable to a string 
Rating:
Not Rated Yet 
Contributor:
Andre Guirard 
Category:
Lotusscript 
Type:
Debugging 
Document Release:
1.0 
Notes Version:
R6.x, R8.x, R7.x 
Last Modified:
14 May 2009 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
When debugging code (or logging errors) it's often useful to be able to record the value of a variable via a string containing only printable characters. The function below can be passed any value, and returns a text string that, to the best of its ability, succinctly describes the contents of the variable.


Examples are shown below to help you interpret the output. If you get something not shown here it's easy enough to look at the code and see what kind of input generates that output.

A version of this was previously posted in the forums that has special code for LC LSX objects. Again, it's not difficult to add to the case statement if there are specific custom classes that you want to include certain information from to identify them.

Usage / Example
Sample return values:
Input: the string 'hello there "Dan"?'
Output: "hello there ""Dan""?"
Note: strings are always enclosed in quotes, with inner quotes doubled.

Input: The number 47.67
Output: 47.67

Input: Array containing strings "abc" and "def(carriage return)(newline)ghi"
Output: ("abc", "def\13.\10.ghi")
Note: nonprintable characters are displayed using backslash followed by the unicode character number in decimal, then "."

Input: an uninitialized Variant variable.
Output: EMPTY

Input: A "List As Integer" containing the key "One" with value 1, and the key "Two" with value 2.
Output: {One|1, Two|2}

Input: An object of class Wheelie
Output: WHEELIE

Input: A NotesView object for view "lkCompany"
Output: NOTESVIEW(lkCompany)
Code Attachments
debugstr.lss (2 Kbytes)
 Comments
Posted by Jan Schulz on 05/16/2009 09:01:34 AMLove it, thanks!
now we only need a "dump" facility for all objects when an error is thrown...
 Add your comment!