C++ 将输入的字符串中英文大写字母改成对应小写字母,并且过滤掉非英文字母字符


#include <stdlib.h>
#include <string.h>
#include <ctype.h>

/*
功能:将输入的字符串中英文大写字母改成对应小写字母,并且过滤掉非英文字母字符
    
输入:字符串
    
输出:结果字符串,保证输出地址有效。
     
返回:0表示成功,其它返回-1
     
*/

int  ProcessString(char * strInput,char *strOutput)
{
    while (*strInput)
    {
        if (isalpha(*strInput))
        {
            char single = *strInput;
            *strOutput = tolower(single);
            strOutput++;            
        }
        strInput++;    
    }    

    return 0;
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM