Alan LeRoy

Member

Last active 3 years ago

  1. 3 years ago
    Wed Apr 22 21:01:22 2020

    That works!

    Thank you Marco.

  2. Wed Apr 22 18:29:17 2020
    Alan LeRoy started the conversation how to include "\(" and ")" in formatted string output.

    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.

  3. 4 years ago
    Sun Feb 16 17:36:02 2020
    Alan LeRoy started the conversation HTTPServer.

    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.

  4. Sun Feb 16 17:32:00 2020
    Alan LeRoy joined the forum.