#string #display #ops #weird

strmath

Do math with your strings

5 unstable releases

0.5.0 Jun 11, 2024
0.4.7 Jun 5, 2024
0.4.5 Apr 1, 2024
0.4.1 Mar 26, 2024
0.1.2 Mar 20, 2024

#413 in Math

Download history 420/week @ 2024-03-21 370/week @ 2024-03-28 54/week @ 2024-04-04 1/week @ 2024-04-11 126/week @ 2024-05-30 198/week @ 2024-06-06 27/week @ 2024-06-13 2/week @ 2024-06-27 33/week @ 2024-07-04

80 downloads per month

MIT license

25KB
531 lines

STRMATH

  • Do math with strings. In Rust.

  • I made this with demonstrative purposes.

  • Not intended for production usage btw.

Usage

use strmath::Str;


lib.rs:

A simple library for weird string manipulation techniques.

Strmath is a library that provides a simple way to manipulate strings in a weird way. Such as:

  • Adding a string to another string or anything that implements the trait Display.
  • Subtracting a string from another string.
  • Multiplying a string with another string/chars.
  • Dividing a string with another string/chars.

Glossary

  • Str: The main struct that holds the string.
  • Ops: The module that holds the operations.

Str

The main struct that holds the string. It is just a simple wrapper around the String struct.

use strmath::Str;
let s = Str::from("Hello, ");
let x = Str::from("World!");
let y = s + x;

Ops

The module that holds the operations. Refer to the ops module for more information. It contains the following operations:

  • Add
  • AddAssign
  • Sub
  • SubAssign
  • Mul
  • MulAssign
  • Div
  • DivAssign
  • Rem
  • RemAssign

Implementations

The module that holds the implementations. Refer to the imp module for more information.

Formatting

The module that holds the formatting functions. Refer to the fmt module for more information.

No runtime deps

Features