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;
}
原文地址:https://www.cnblogs.com/jdfemqi/p/3312575.html