The Wayback Machine - https://web.archive.org/web/20230123214308/https://www.geeksforgeeks.org/get-size-of-string-in-julia-sizeof-method/
Skip to content
Related Articles
Open in App
Not now

Related Articles

Get size of string in Julia – sizeof() Method

Improve Article
Save Article
  • Last Updated : 26 Mar, 2020
Improve Article
Save Article

The sizeof() is an inbuilt function in julia which is used to return the size of the specified string i.e, returned size will be equal to the number of code units in the string multiplied by the size (in bytes) of one code unit.

Syntax:
sizeof(str::AbstractString)

Parameters:

  • s::AbstractString: Specified string

Returns: It returns the size of the specified string i.e, returned size will be equal to the number of code units in the string multiplied by the size (in bytes) of one code unit.

Example 1:




# Julia program to illustrate 
# the use of String sizeof() method
  
# Get size of the specified string
println(sizeof(""))
println(sizeof("GFG"))
println(sizeof("123"))
println(sizeof("GeeksforGeeks"))

Output:

0
3
3
13

Example 2:




# Julia program to illustrate 
# the use of String sizeof() method
  
# Get size of the specified string
println(sizeof("∀"))
println(sizeof("∀∀"))
println(sizeof("∀123"))
println(sizeof("∀∀∀GFG"))

Output:

3
6
6
12
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!