-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.lldbinit
6 lines (5 loc) · 946 Bytes
/
.lldbinit
1
2
3
4
5
6
# To reload: command source ~/.lldbinit
# Given data, decode to JSON and print it in the debugger
command regex json 's/(.+)/expr let input = %1; print(String(data: try! JSONSerialization.data(withJSONObject: (input is String ? try! JSONSerialization.jsonObject(with: (input as! String).data(using: .utf8)!, options: []) : (input is Data ? (try! JSONSerialization.jsonObject(with: input as! Data, options: [])) : input as! Any)), options: [.prettyPrinted]), encoding: .utf8)!)/'
# Given a number with scientific notation, print out a full number with 20 decimal places
command regex number 's/(.+)/expr let value = %1; if let doubleValue = value as? Double { print(String(format: "%.20f", doubleValue)) } else if let floatValue = value as? Float { print(String(format: "%.20f", Double(floatValue))) } else if let intValue = value as? Int { print(String(format: "%.20f", Double(intValue))) } else { print("Error: Input is not a valid number") }/'