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,将每个字母单独转换为小写或大写以创建另 ...
随机推荐
- String的几种比较方法对比(Compare,CompareTo, CompareOrdinal、Equals)
String类字符串比较大概有4种方法:Compare(),CompareTo(), CompareOrdinal()和Equals(). Compare()方法是CompareTo()的静态版本.而 ...
- iOS开发之第三方分享QQ分享,史上最新最全第三方分享QQ方式实现
本文章源码地址: https://github.com/zhonggaorong/QQLoginDemo 项目搭建参考: (包含QQ登录源码下载 . QQ sdk集成) http://blog.cs ...
- java中只能有一个实例的类的创建
Java中,如果我们创建一个类,想让这个类只有一个对象,那么我们可以 1:把该类的构造方法设计为private 2:在该类中定义一个static方法,在该方法中创建对象 package test; / ...
- Laravel OAuth2 (二) ---配置与数据库设计
前言 使用 OAuth2 进行第三方登陆分为好几种情况,例如完全第三方登陆,不保存任何用户信息,或者第三方登陆后保存用户信息关联本站账号.个人觉得保存一下用户信息比较妥当(虽然这样注册的时候让用户觉得 ...
- Sublime Text 2使用技巧汇总
一.下载链接: Windows-64bit: http://pan.baidu.com/s/1o6QdKYu 其它版本请移步官网: http://www.sublimetext.com/ 二.破解Li ...
- Cobbler自动化部署
一:PXE.Kickstart与Cobbler的概念: PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的技术,需要网卡的硬件支持,工作于C/S的 ...
- python中os.walk浏览目录和文件
#!/usr/bin/env python # 2.py # use UTF-8 # Python 3.3.0 # os.walk()的使用 import os # 枚举dirPath目录下的所有文件 ...
- Mac平台编译mupdf-qt的开源项目
How to compile mupdf-qt Compile on Linux Install tools and thirdparty libraries You should install s ...
- 一个ShellExecute的超全说明(www.phidels.com这个网站很多内容)
I. Introduction / Déclaration ShellExecute fait partie des innombrables fonctions de l'API Windows ; ...
- STL string 模拟
下面的代码来自c++ primer plus第5版第12章,书中代码写的非常好: // string1.h -- fixed and augmented string class definition ...