so many LCD clock example projects and I can't find a solution to LCD format adding trailing spaces.
here is my code:
char line0[16]; // declare 16 character array for line0 of i2C display.
char line1[16]; // declare 16 character array for line1 of i2C display.
char timeWeekDay[10];
strftime(timeWeekDay,10, "%A", &timeinfo); // returns day as text, longest is "Wednesday" 9 chars plus end char.
char timeDate[3]; // 2 digits plus end char
strftime(timeDate,3, "%02d", &timeinfo); // returns date as 2 digits "11"
char timeMonth[3];
strftime(timeMonth,4, "%B", &timeinfo); // returns month as chars "November" is cut down to "Nov".
sprintf(line0, "%s %s %s", timeWeekDay, timeDate, timeMonth); // weekday length can be 6,7,8 or 9 chars.
on Line0 of the LCD today, I see "Tuesday 17 Nov ", tomorrow "Wednesday 18 Nov", and the day after "Thursday 19 Novv". Day of week can be 6, 7, 8 or 9 in length. Very easy, just pad with spaces.
I've tried width specifiers as described in C++ sprintf tutorials. I've also found examples of using FOR loops to dynamically add spaces based on "string" length. 8 hours later, here I am, first Ardunio forum post.
The preference would be a width specifier added to the sprinf line, is this possible?