zoukankan      html  css  js  c++  java
  • 字符串大小写转换

     1 #include<stdafx.h>
     2 #include<iostream>
     3 #include<string>
     4 #include <algorithm> 
     5 
     6 using namespace std;
     7 
     8 int main(void)
     9 {
    10     //string str;
    11     char ch;
    12     int len = 0, count = 0;
    13     string str = "abcdefghijklnmopqrstuvwxyz123";
    14     transform(str.begin(), str.end(), str.begin(), toupper);
    15     cout << str << endl;
    16     //while (getline(cin, str) && cin >> ch)
    17     //{
    18     //    len = str.length();
    19     //    for (int i = 0; i < len; i++)
    20     //    {
    21     //        if (str[i] >= 'a'&&str[i] <= 'z')
    22     //        {
    23     //            str[i] += ('A' - 'a');
    24     //        }
    25     //    }
    26     //    if (ch >= 'a' && ch <= 'z')
    27     //    {
    28     //        ch += ('A' - 'a');
    29     //    }
    30     //    for (int i = 0; i < len; i++)
    31     //    {
    32     //        if (str[i] == ch)
    33     //        {
    34     //            count++;
    35     //        }
    36     //    }
    37     //    cout << count << endl;
    38     //}
    39 
    40     
    41     return 0;
    42 }
  • 相关阅读:
    react学习笔记一
    获取客户端时间差
    ts
    Linux学习笔记
    vuex 基本使用
    SQL入门
    ios 中倒计时计算,时间戳为NaN
    git归纳总结
    JS原型对象
    vue笔记
  • 原文地址:https://www.cnblogs.com/hhboboy/p/5522439.html
Copyright © 2011-2022 走看看