Skip to content

Examples that contain only C strings, not Strings? #295

@terrypin999

Description

@terrypin999

Not an 'issue', sorry, but I need advice on an embarrasingly basic aspect: which if any of the Examples include Strings? I've been trouble-shooting erratic behaviour for days of the sort I gather is often down to the use of Strings. My current project (which includes five other libraries) has this function, derived partly from ds3231.ino and other extracts:

`void updateRTC() // Use RTC to get date & time
{
DateTime now = rtc.now();

//buffer can be defined using following combinations:
//---------------------------------------------------
//hh - the hour with a leading zero (00 to 23)
//mm - the minute with a leading zero (00 to 59)
//ss - the whole second with a leading zero where applicable (00 to 59)
//YYYY - the year as four digit number
//YY - the year as two digit number (00-99)
//MM - the month as number with a leading zero (01-12)
//MMM - the abbreviated English month name ('Jan' to 'Dec')
//DD - the day as number with a leading zero (01 to 31)
//DDD - the abbreviated English day name ('Mon' to 'Sun')

Day = now.day();
Month = now.month();
Year = now.year();
Secs = now.second();
Hours = now.hour();
Minutes = now.minute();
dofweek = daysOfTheWeek[now.dayOfTheWeek()];

// Calculate the current day of year, doy
doy = dayOfYear(Day, Month, Year);

constructPaddedRTCstrings();

// Serial.print(F("From upDateRTC: doy = "));
// Serial.println(doy);
//
myDate = ""; // Reset
myTime = ""; // Reset

} // End updateRTC
`

Which of these are Strings not strings?

If any are Strings, I want to rewrite that function (and many others0 with strings. Which Examples should I focus on for that please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions