Skip to content

Commit

Permalink
Create strings concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenad committed Jun 18, 2024
1 parent ebd748d commit edfb9a3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions concepts/strings/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"blurb": "ByteArray is a sequence of ASCII characters longer than 31 characters, written using double quotes",
"authors": [
"misicnenad"
],
"contributors": []
}
1 change: 1 addition & 0 deletions concepts/strings/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# String
3 changes: 3 additions & 0 deletions concepts/strings/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Introduction

In Cairo, there's no native type for strings. Instead, you can use a single `felt252` to store a short string of up to 31 characters, or a `ByteArray` for strings of arbitrary length. Short strings use single quotes and `ByteArray` uses double quotes. All characters must follow the ASCII standard.
14 changes: 14 additions & 0 deletions concepts/strings/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"url": "https://book.cairo-lang.org/ch02-02-data-types.html#string-types",
"description": "String types in the Cairo book"
},
{
"url": "https://starknet-by-example.voyager.online/getting-started/basics/bytearrays-strings.html",
"description": "Starknet by Example section on Strings and ByteArrays"
},
{
"url": "https://docs.starknet.io/architecture-and-concepts/smart-contracts/serialization-of-cairo-types/#serialization_of_byte_arrays",
"description": "Starknet docs explaining how ByteArray is implemented and how it's serialized"
}
]

0 comments on commit edfb9a3

Please sign in to comment.