Returns the input enclosed in double quotes if it's not NULL; otherwise returns "(null)". For example, "\"Hello\"" is returned for input "Hello". This is useful for printing a C string in the syntax of a literal. Known issue: escape sequences are not handled yet.
| 2128 | // |
| 2129 | // Known issue: escape sequences are not handled yet. |
| 2130 | String String::ShowCStringQuoted(const char* c_str) { |
| 2131 | return c_str ? String::Format("\"%s\"", c_str) : String("(null)"); |
| 2132 | } |
| 2133 | |
| 2134 | // Copies at most length characters from str into a newly-allocated |
| 2135 | // piece of memory of size length+1. The memory is allocated with new[]. |