Today, we need to implement a function to convert lower-case letters to upper-case letters. Because the input parameter is a string class in SL, the first idea is to use the Transform Algorithm to implement this function, but an error is returned.
Translated from http://blog.csdn.net/justin12zhu/article/details/5649236Today we need to implement a lowercase letter to uppercase function, because the incoming parameter is the STL string class, so the first idea is to use the transform algorithm
ToLower convert uppercase to lowercase.Non-alphabetic characters do not make processing.This function is a bit special. He handles the characters rather than the strings.The so-called inability to handle strings does not mean that he cannot handle
Header files: #include
Definition function: int toupper (int c);
Function Description: If the parameter c is a lowercase letter, the corresponding uppercase letter is returned.
Return value: Returns the converted uppercase letter, returning
Below is the rewriting of some string library functions in the C language. Now I will post the code to share with you,
If any errors are found, please give me more advice.
# Include # Include # Include
//////////////////////////////////////// ////
String comparisons (ignoring case), which we will generally write as str1. ToUpper () = = str2. ToUpper () or str1. ToLower () = = str2. ToLower ()
This will be relatively inefficient, especially in cycles, which are slow to run as compared to
This article conducts in-depth analysis and research on the String class of. NET Framework. It provides detailed information about the implementation of the String class, and describes the efficiency of various usage methods of the String.Many of
today, I wrote a small example of converting all lowercase letters in a string into uppercase letters.http://blog.csdn.net/yasaken/article/details/73039031#include"stdafx.h"2#include string>3#include 4#include 5 6 using namespacestd;7 8 int_tmain
String case-insensitive conversion functions-blog channel-csdn. net
String case Conversion Function
Category: C/C ++/C #
Read by 1495
Comment (0)
Favorites
Report Stringbasicalgorithmc multi-thread function
Recently
7.1 stringClass7.2StringbufferClass
7.1 stringClassObjects of the string class cannot be changed once they are created.String constant. In the previous program, we have used the String constant multiple times.For example, "input a integer data/N"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.