Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 32 characters in body
Source Link
ngm
  • 4.4k
  • 9
  • 29

R, 76 bytes

Please also have a look at this shorter72 byte R answer that is also locale-independent.

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

R, 76 bytes

Please also have a look at this shorter R answer.

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

R, 76 bytes

Please also have a look at this 72 byte R answer that is also locale-independent.

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

added 106 characters in body
Source Link
ngm
  • 4.4k
  • 9
  • 29

R, 76 bytes

Please also have a look at this shorter R answer.

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

R, 76 bytes

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

R, 76 bytes

Please also have a look at this shorter R answer.

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

Source Link
ngm
  • 4.4k
  • 9
  • 29

R, 76 bytes

sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!

weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

AltStyle によって変換されたページ (->オリジナル) /