FLASH-X
Doxygen Generated Documentation From Interface Source Code
removeNullChar.F90
Go to the documentation of this file.
1!! NOTICE
2!! Copyright 2022 UChicago Argonne, LLC and contributors
3!!
4!! Licensed under the Apache License, Version 2.0 (the "License");
5!! you may not use this file except in compliance with the License.
6!!
7!! Unless required by applicable law or agreed to in writing, software
8!! distributed under the License is distributed on an "AS IS" BASIS,
9!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10!! See the License for the specific language governing permissions and
11!! limitations under the License.
12!!
36
37subroutine removeNullChar(str1)
38
39 implicit none
40
41 character(len=*), intent(inout) :: str1
42 integer :: i
43 logical :: nullCharFound
44 integer :: temp_int
45
46
47 nullCharFound = .false.
48
49 do i=1, len(str1)
50 if(nullCharFound) then
51 str1(i:i) = " "
52 else if(str1(i:i) == "\0") then
53 str1(i:i) = " "
54 nullCharFound = .true.
55 else
56 temp_int = ichar(str1(i:i))
57 if(temp_int == 0) then
58 str1(i:i) = " "
59 nullCharFound = .true.
60 end if
61 end if
62
63 end do
64
65
66end subroutine removeNullChar
subroutine removeNullChar(str1)