snippet for debugging constants
Posted: Fri Oct 12, 2007 8:13 pm
this code grabs your clipboard text, searches it for constants
and generates a new clipboard text, a PB-code to debug these constants.
and generates a new clipboard text, a PB-code to debug these constants.
Code: Select all
; conDeb.pb
; (constant debugger)
; searches clipboard text for constants
; and sets a PureBasic Debug code for these
; constants as new clipboard text.
; http://www.purebasic.fr/german/viewtopic.php?t=14517
; by '#null' (thanks to 'sibru')
text.s = GetClipboardText()
NewList const.s()
AddElement(const())
For i=1 To Len(text)
char = Asc( Mid(text,i,1) )
If char = 35;"#"
switch = 1
const()+"#"
ElseIf switch And Not FindString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_", Chr(char), 1)
switch = 0
AddElement(const())
ElseIf switch
const()+Chr(char)
EndIf
Next
text=""
ForEach const()
If const()
text + ";" + const() + #CRLF$
EndIf
Next
text + #CRLF$
ForEach const()
If const()
text + "Debug " + Chr(34) + const() + " = " + Chr(34) + " + Str(" + const() + ")" + #CRLF$
EndIf
Next
SetClipboardText(text)