Adds zeros at the beginning of a string.
newStr = zfill(str, l)
Where:
str
: String that the user wants to fill with leading zeros..l
: Integer indicating the length of the resuling string.If l
is greater than the length of str
, it returns a string of length l
with str
padded with zeros at the beginning. If l
is lower or equal to the
length of str
, it returns str
.
The following program fills a string with leading zeros:
PROGRAM zfillExample
USE FU_Strings, ONLY: zfill
IMPLICIT NONE
WRITE(*,*) zfill('myStr', 12)
END PROGRAM zfillExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
String that the user wants to fill with leading zeros. |
||
integer(kind=i8), | intent(in) | :: | l |
Integer indicating the length of the resuling string. |
If l
is greater than the length of str
, it returns a string of length l
with str
padded with zeros at the beginning. If l
is lower or equal to the
length of str
, it returns str
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
String that the user wants to fill with leading zeros. |
||
integer(kind=i16), | intent(in) | :: | l |
Integer indicating the length of the resuling string. |
If l
is greater than the length of str
, it returns a string of length l
with str
padded with zeros at the beginning. If l
is lower or equal to the
length of str
, it returns str
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
String that the user wants to fill with leading zeros. |
||
integer(kind=i32), | intent(in) | :: | l |
Integer indicating the length of the resuling string. |
If l
is greater than the length of str
, it returns a string of length l
with str
padded with zeros at the beginning. If l
is lower or equal to the
length of str
, it returns str
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
String that the user wants to fill with leading zeros. |
||
integer(kind=i64), | intent(in) | :: | l |
Integer indicating the length of the resuling string. |
If l
is greater than the length of str
, it returns a string of length l
with str
padded with zeros at the beginning. If l
is lower or equal to the
length of str
, it returns str
.