- 积分
- 6
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-8-20
- 最后登录
- 1970-1-1
|
发表于 2016-8-21 21:31:03
|
显示全部楼层
!=============================================================
subroutine StrReplace(InStr,OldChar,NewChar,OutStr)
!------------------------------------------------------------
!---将字符串InStr中的字符串OldChar替换成NewChar
!---结果放入字符串OutStr中
!---吴徐平2013-07-20(wxp07@qq.com)
!------------------------------------------------------------
implicit none
character(len = *) , Intent( IN ) :: InStr
character(len = *) , Intent( IN ) :: OldChar
character(len = LEN(OldChar)) , Intent( IN ) ::NewChar
character(len = LEN(InStr)) , Intent( INOUT ) :: OutStr
integer :: i ! loop variable
OutStr=InStr
i=INDEX(OutStr,OldChar)
do while(i>0)
OutStr(i:i+LEN(OldChar)-1)=NewChar
i=INDEX(OutStr,OldChar)
end do
end subroutine StrReplace
!------------------------------------------------------------
把-符号替换一下就行了 |
|