(转帖)如何将字符串前后的空白去除? (使用string.find_first_not_of, string.find_last_not_of) (C/C++)

本文提供了一个实用的C++函数,用于去除std::string类型变量的前导和尾随空白字符。此函数通过查找非空白字符的位置并据此修改字符串,从而实现去除空白的功能。

转帖博客地址

http://www.cnblogs.com/oomusou/archive/2006/11/17/564197.html

 

下面的函数定义可以将string的前后空白去掉,在处理读入的字符串时非常有用。

 


V_AA_WO_TYPE := 'SOC'; --查询工单推送表中上一次转贴的工单号(根据包含的wafer的第一片) select max(t1.wono) into v_last_wono from (select * from Sj_Push_WO_Createlot t where t.SJcustomer = V_customer and t.type = 'SOC' and t.routing = 'AA' and t.push_flag = 'Y' and instr(t.waferidlist, substr(info.main_wafer_id, 1, 2)) > 0 and t.customerlotid = info.mark_lot_no order by t.repostseq desc) t1 where ROWNUM = 1; if v_last_wono is not null then --判断这笔工单的wono与marklotno是否一致 select t.mark_lot_no into v_last_marklotno from Sj_Push_WO_Createlot where wono = v_last_wono --如果一致,则判断当前工单为二次转帖,上次工单是首次转帖 if v_last_marklotno = v_last_wono then --此时可以取第一片,因为怎么样都是只取到一笔工单 --如果不为空,就去MES中找上次的那笔工单的数据(可能上次是二次转,这次是三次?) select max(t.wono), max(t.custermerid), max(t.lotid), max(t.productid), max(t.shiprequirement), max(t.lotowner), max(t.repostseq) into v_last_wono, v_last_customerid, v_last_lotidlist, v_last_productID, v_last_shipcode, v_last_lotowner, V_last_repost_seq from FWJ2BUMP.SJ_WO_CREATELOT_INFO@MESABTDB t where t.type = 'SOC' and t.customerlotid = info.mark_lot_no and t.wono = v_last_wono; end if; --如果不一致,则判断当前工单为三次及以上转帖,上次工单是二次及以上转帖 if v_last_marklotno != v_last_wono then --此时需要精确匹配片号,因为二次工单可能会存在多笔工单,需要都找到 end if; 理解一下代码,然后跟我的注释,写一下第二个if、
最新发布
08-19
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值