Skip to content

Johnathan31/scriptum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 scriptum ⇄ 🐍🔁🛠️

**scriptum** module provides you many common & uncommon cases in python, including some text manipulation functions & conversions

License Python pypi


Features

  • Functions for most popular cases.
  • Text manipulation functions.
  • Pure python 3.10 to 3.14+.
  • No dependencies.
  • custom text and background colouring.
  • Binary conversion.
  • Hexadecimal notation & decimal code point unicode conversion.
  • Conversion between: cases, binary, unicode.

Supported Cases

The available cases in scriptum are:

case view
mocking MoCkInG CaSe
camel camel Case
pascal PascalCase
snake snake_case
kebab kebab-case
cobol COBOL-CASE
constant CONSTANT_CASE
train Train-Case

Aliases

some cases have alias names:

name alias
constant upper_snake
constant const

Manipulative functions

Pytext also features various manipulative functions, which includes:

function description
convert(text, type, to) convert text to to
binary(text) Represent text in binary
unicodify(text, hexa) Return text in unicode
color(text, color, bgc, style) Colors text

🧰 Installation

pip install scriptum

Usage

Basic Usage

>>> from scriptum import reverse, pascal, convert

>>> reverse("Hello world", foreach=True)
'dlrow olleH'

>>> pascal("foo bar baz")
'Foo Bar Baz'

>>> convert("MAX_SPEED", type_="constant", to="train")
'Max-Speed'

Case conversion

all the formats, cases, types in scriptum are collected in one function: convert:

>>> from scriptum import convert

>>> convert(
... "01001000 01100001 01100011 01101011 01100101 01110010",
... type_="binary", 
... to="mocking"
... )
'HaCkEr'

>>> convert(
... text="0x0048 0x0069 0x0021 0x0021 0x0021",
... type_="unicode",
... to="string"
... )
'Hi!!!'

Unicode support (Implemented)

Unicode is greatly supported, as you can use any function on any non-ASCII Characters:

>>> from scriptum import reverse

>>> reverse("أهلا", foreach=True) # non-ASCII Characters (Arabic)
'الهأ'

And the unicodify function in scriptum, can assist in converting to either Unicode Hexadecimal Code Points (0xXXXX), or Decimal Code Points (NNN)

Important notes

  • The color function, may fail to do it's job in some console environments.

  • Although you can use any unicode character, sometimes it's seemingless to use them as some cases doesn't exist in other writing systems:

>>> from scriptum import camel

>>> camel("谢谢") # Chinese (non-ASCII)
'谢谢' # No change (seemless)
  • The binary function represents only string datatypes (str), thus any other type given is internally converted to string.
>>> from scriptum import binary

>>> binary(5) # non-string
'00110101'
>>> binary("5")
'00110101'

About

A text utility library for text conversion between: cases, binary & unicode formats, and reversing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages