点击查看详细介绍

取出一段字符串指定的中间字符串功能函数

nxopen 6年前 1775 7

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数功能:取出一段字符串指定的中间字符串

参数说明:

GetMidStr(

CString &strSTR, //输入:待取得原字符串

CString &strStart, //输入:开始取得字符串(结果不包含此字符串)

CString &strEnd, //输入:结尾的字符串(结果不包含此字符串)

CString &strValue //输出:取到的结果

)

使用举例:

CString strValue;

GetMidStr("ABCD19792ABC19CD", "D", "C", strValue);

返回的结果 strValue="19792AB"


函数代码:

//取中间字符串
int UGapi_com::HuBase::GetMidStr(CString &strSTR, CString &strStart, CString &strEnd, CString &strValue)
{
    int err = 0;
    int intStartIdx = strSTR.Find(strStart);    
    int intEndIdx = (intStartIdx + strStart.GetLength()) + (strSTR.Right(strSTR.GetLength() - (intStartIdx + strStart.GetLength())).Find(strEnd));

●●●请先 登陆注册 后查看●●●


1

最新回复 (7)
  • Chenyw VIP会员 6年前
    1

    生命不息,学习不止

  • guo172960885 VIP会员 6年前
    2

    学习中,谢谢分享了!

  • 不及无耐 VIP会员 6年前
    3

    生命不息,学习不止

  • 王牌飞行员 VIP会员 5年前
    4

    学习了,谢谢胡工分享

  • chendong_888 5年前
    5

    学习了,谢谢胡工分享

  • songge_2018 VIP会员 5年前
    6

    生命不息,学习不止

  • a970356240 VIP会员 1月前
    7

    生命不息,学习不止

请登录后发表新帖