Member
Last active 3 years ago
That works!
Thank you Marco.
I need a method to return a string in the phone number format "\(XXX\) - xxx - xxxx" where the input value is a string of 10 characters. The "\(" and the "\)" are required as the output string is embedded in a PDF file in a draw text command of Td().
My tried methods are as follows
func formatPhone(theData: String)
{
return "\(\( \(theData[0...2])\) - \(theData[3...5]) - \(theData[6...9]))"
}
I have also tried
func formatPhone(theData: String)
{
return "\("+"\(theData[0...2])+"\) ) - \(theData[3...5]) - \(theData[6...9]))"
}
I have also tried
func formatPhone(theData: String)
{
return "\("+theData[0...2]+"\) - "+theData[3...5]"+" - "+theData[6...9]
}
I have not found a way to include the "\(" or the "\)" in the formatted output as the gravity compiler thinks there is an error as "\(" or the next ")" have a special meaning when compiling. Any ideas how to do this would be most appreciated. It is probably simpler than I make it out to be!
Thanks for your time in advance.
I have managed to get HTTPServer working but I can not successfully access the body object in the DidReceiveRequest event handler. In my case this contains JSON data but I have been unable to retrieve this. Also this event is to return an object but I am unclear what format/properties this object should contain from the documentation.
Thanks, for any and all help.