PowerBroker2 / SafeString

This SafeString library is designed for beginners to be a safe, robust and debuggable replacement for string processing in Arduino. Note, this is NOT my work, I am simply hosting it for easy access. The original code belongs to Forward Computing and Control Pty. Ltd.
https://www.forward.com.au/pfod/ArduinoProgramming/SafeString/index.html
38 stars 12 forks source link

SafeString from Arduino String? #50

Closed ModischFabrications closed 2 years ago

ModischFabrications commented 2 years ago

The documentation shows a few ways to create SafeStrings from raw inputs, but none from Arduino Strings. I would like to port over some of my code, but existing libraries all use generic String.

I guess a sidecut through String.c_str could work, but it seems risky regarding automatic updates. Could you extend the readme, ideally adding even an example for it?

ModischFabrications commented 2 years ago

Okay, found it, it's described in https://www.forward.com.au/pfod/ArduinoProgramming/SafeString/index.html#converting , but difficult to find. Feel free to close this issue, seems like it's documented already. Still, this conversion was my initial contact point and it probably will for other newcomers as well, it might be sensible to link it somewhere as a "quick migration" guide instead of describing it after >20 paragraphs,

    createSafeString(sMsg, 80);
    sMsg = msg.text.c_str();
drmpf commented 2 years ago

Thanks for that let me put a link higher up.

drmpf commented 2 years ago

Updated https://www.forward.com.au/pfod/ArduinoProgramming/SafeString/index.html with a bold note under Quick Start. Please comment back here if you think more is needed, or just close this case. Thanks