C# ignoring letter case for if statement(Stackoverflow)
Question:
I have this if statement:
if (input == 'day')
Console.Write({0}, dayData);
When the user types 'day' it should be so that the console writes the data in that array. It works fine but is there anyway to get it to work if the user types 'DaY' or 'dAy' etc. I know I could do:
if (input == 'day' || input == 'dAy' || input == 'DaY')
Console.WriteLine({0}, dayData);
But is there anyway to make it shorter and tidier?
Thanks.
Answer:
if (input.ToLower() == "day") { }
C# ignoring letter case for if statement(Stackoverflow)的更多相关文章
- 【Leetcode_easy】784. Letter Case Permutation
problem 784. Letter Case Permutation 参考 1. Leetcode_easy_784. Letter Case Permutation; 2. Grandyang; ...
- 784. Letter Case Permutation 字符串中字母的大小写组合
[抄题]: Given a string S, we can transform every letter individually to be lowercase or uppercase to c ...
- leetcode 784. Letter Case Permutation——所有BFS和DFS的题目本质上都可以抽象为tree,这样方便你写代码
Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...
- [Swift]LeetCode784. 字母大小写全排列 | Letter Case Permutation
Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...
- [LeetCode] Letter Case Permutation 字母大小写全排列
Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...
- LeetCode 784 Letter Case Permutation 解题报告
题目要求 Given a string S, we can transform every letter individually to be lowercase or uppercase to cr ...
- [LeetCode&Python] Problem 784. Letter Case Permutation
Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...
- 【LeetCode】784. Letter Case Permutation 解题报告 (Python&C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 回溯法 循环 日期 题目地址:https://leet ...
- LeetCode算法题-Letter Case Permutation(Java实现)
这是悦乐书的第315次更新,第336篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第184题(顺位题号是784).给定一个字符串S,将每个字母单独转换为小写或大写以创建另 ...
随机推荐
- BZOJ 1022 小约翰的游戏 (Anti-Nim游戏)
题解:注意题目中规定取到最后一粒石子的人算输,所以是Anti-Nim游戏,胜负判断为: 先手必胜: 1.所有堆的石子数都为1且游戏的SG值为0: 2.有些堆的石子数大于1且游戏的SG值不为0. #in ...
- ACM—循环小数转变成分数知识点_C++实现
在小学的时候,我们的学生都能把“整数表示成分母是1的分数”,而且大多数学生也都能把有限小数和循环小数表示成分数的形式.这样,整数.分数.有限小数.循环小数都属于有理数.教科书中说“整数和分数统称有理数 ...
- Ubuntu Linux: How Do I install .deb Packages?
Ubuntu Linux: How Do I install .deb Packages? Ubuntu Linux: How Do I install .deb Packages? by Nix C ...
- CF 192 Div2
A.Cakeminator 暴搞之,从没有草莓覆盖的行.列遍历 char map[30][30]; int vis[30][30]; int hang[30],lie[30]; int main() ...
- 让你提前认识软件开发(19):C语言中的协议及单元測试演示样例
第1部分 又一次认识C语言 C语言中的协议及单元測试演示样例 [文章摘要] 在实际的软件开发项目中.常常要实现多个模块之间的通信.这就须要大家约定好相互之间的通信协议,各自依照协议来收发和解析消息. ...
- MessageDigest简单介绍
本文博客原文 參考文章:http://blog.sina.com.cn/s/blog_4f36423201000c1e.html 一.概述 java.security.MessageDigest类用于 ...
- ThinkPHP - 组织分类结构
- 二十三种设计模式及其python实现
本文源码寄方于github:https://github.com/w392807287/Design_pattern_of_python 参考文献: <大话设计模式>——吴强 <Py ...
- Setting property 'source' to 'org.eclipse.jst.jee.server [问题点数:40分]
链接地址:http://bbs.csdn.net/topics/390131469 警告: [SetContextPropertiesRule]{Context} Setting property ' ...
- Java安全机制之泛型(JDK1.5)
泛型,类型安全机制. 好处: 1.将运行时期出现问题ClassCastException转移到了编译时期,方便解决问题,减少运行时期的问题,有利于程序的健壮性. 2.避免了强制转换的麻烦 泛型格式: ...