{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# String Collection" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from rich.console import Console\n", "from rich.table import Table\n", "\n", "from byteclasses.print import byteclass_info, byteclass_inspect\n", "from byteclasses.types.collections import String" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "string = String(32, value=\"my string collection\")\n", "byteclass_info(string)\n", "byteclass_inspect(string)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "table = Table(title=\"Generic String Collection\")\n", "\n", "table.add_column(\"Name\")\n", "table.add_column(\"Value\")\n", "\n", "table.add_row(\"string[:]\", str(string[:]))\n", "table.add_row(\"string[::2]\", str(string[::2]))\n", "table.add_row(\"string[0]\", str(string[0]))\n", "table.add_row(\"string[0].value\", str(string[0].value))\n", "table.add_row(\"string[0].data\", str(string[0].data))\n", "console = Console()\n", "console.print(table)" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 2 }