【ARTS】01_03_左耳听风-20181126~1202

这篇博客涵盖了ARTS的四个方面:算法讲解LeetCode的to-lower-case问题,审查Windows下格式字符串漏洞分析,分享如何使用OD调试OCX,以及探讨业务安全中的情报策略。内容包括算法实现、漏洞利用方法、调试技术细节和业务安全思考。
摘要由CSDN通过智能技术生成

ARTS:

  • Algrothm: leetcode算法题目
  • Review: 阅读并且点评一篇英文技术文章
  • Tip/Techni: 学习一个技术技巧
  • Share: 分享一篇有观点和思考的技术文章

Algorithm

to-lower-case

https://leetcode.com/problems/to-lower-case/

1)problem
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.

Example 1:
    Input: "Hello"
    Output: "hello"
Example 2:
    Input: "here"
    Output: "here"
Example 3:
    Input: "LOVELY"
    Output: "lovely"
2)answer

声明一个新的字符串变量,对传入的字符串的字符逐个读取,如果是大写字母就取小写与大写之间的差值,得到大写字符对应的小写字母ASCII码存进字符串中。处理完后返回结果。

3)solution

Cpp:

#include <stdio.h>
#include <string>
using std::string;


class Solution {
public:
	string toLowerCase(string str) {
		string re_val = "";
		for (char str_val : str)
		{
			if (str_val >='A'&& str_val <='Z')
			{
				// 取小写与大写之间的差值,得到字符对应的小写ASCII码对应是什么存进字符串中
				re_val += (str_val + ('a' - 'A'));
			}
			else
			{
				// 如果是小写就不处理
				re_val += str_val;
			}

		}
		return re_val;

	}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值