Skip to content

Fortran trim vs. Python .rstrip() #3

@Beliavsky

Description

@Beliavsky

Thanks for your repo. Here is something you could add. The Fortran code

write (*,"(a)") "'" // trim(" ab ") // "'"
write (*,"(a)") "'" // trim(adjustl(" ab ")) // "'"
end

is equivalent to Python code

print("'" + " ab ".rstrip() + "'")
print("'" + " ab ".strip() + "'")

so in short, trim(s) in Fortran is equal to s.rstrip() in Python, and trim(adjustl(s)) equals s.strip()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions