How to check the length of a string in Julia?

Viewed 89

I have some string which is being created programmatically as part of a GitHub action. The contents of the string are coming from an API so I don't know how long each part of the string will be. I then need to tweet the string using Twitter.jl. However, right now it errors out sometimes since the string is too long (twitter has a 280 character limit).

How can I check the length of the string in Julia to make sure it is less than 280 characters?

1 Answers

Julia has a build in length function which returns the length of a given string like the following example:

julia> a = "Hello world"
"Hello world"

julia> length(a)
11
Related