dongju.jeong Posted September 16, 2020 Share Posted September 16, 2020 (edited) Isn't this function applied directly to the String variable? Although it applies when used like this, String ex; ex = ex.format(" value %d", 3); but, Are there any format functions that apply right away? Like CString's Format. As a result of the tests, it seems to be applied when using the printf function. Edited September 16, 2020 by dongju.jeong Link to comment
cash-metall Posted September 16, 2020 Share Posted September 16, 2020 it work like spritf String ex = String::format(" value %d", 3); // "value 3" //or const char *m = String::format("value float %.2f", 12.342532f).get(); //"value float 12.34" its static method, you can call it without instance 1 Link to comment
fox Posted September 16, 2020 Share Posted September 16, 2020 Yes, like cash-metall mentioned, format() is a static method. To apply formatting to the calling instance you should use printf()/vprintf(). String ex; ex.printf(" value %d", 3); Thanks! 1 Link to comment
dongju.jeong Posted September 16, 2020 Author Share Posted September 16, 2020 Thank you. Link to comment
Recommended Posts