Skip to main content

A package that provide basic string manipulation functions

Project description

stringmanipulate

Build Status

Description

This Python package provides a collection of string manipulation functions, including grouping anagrams, checking string inclusions, decoding strings, and finding the length of the longest substring without repeating characters.

Installation

To install this package, run the following command in your terminal:

pip install stringmanipulate

Usage

Group Anagrams

groupAnagrams(strs: List[str]) -> List[List[str]]: This function takes a list of strings and groups anagrams together. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. It returns a list where each element is a list of anagrams.

from stringmanipulate import groupAnagrams
# Example usage:
print(groupAnagrams(["bat", "tab", "eat", "tea", "tan", "nat"]))  
# Output: [["bat", "tab"], ["eat", "tea"], ["tan", "nat"]]

Check Inclusion

checkInclusion(s1: str, s2: str) -> bool: This function checks if one string (s1) is a permutation of any substring of another string (s2). It returns True if any permutation of s1 can be found as a substring in s2, otherwise False.

from stringmanipulate import checkInclusion
# Example usage:
print(checkInclusion("ab", "eidbaooo"))  
# Output: True

Length of Longest Substring

lengthOfLongestSubstring(s: str) -> int: This function finds the length of the longest substring without repeating characters in a given string (s). It returns the maximum length of such substrings.

from stringmanipulate import lengthOfLongestSubstring
# Example usage:
print(lengthOfLongestSubstring("abcabcbb"))  
# Output: 3

Decode String

decodeString(s: str) -> str: This function decodes a string that follows a specific pattern where k[encoded_string] indicates that the encoded_string within the square brackets should be repeated k times. It returns the fully decoded string.

from stringmanipulate import decodeString
# Example usage:
print(decodeString("3[a]2[bc]"))  
# Output: "aaabcbc"

Contributing

To contribute to this project, please follow these steps:

  1. Clone the repository:
    git clone https://github.com/software-students-fall2023/3-python-package-exercise-team-dominators-1.git
    
  2. Set up a virtual environment:
    python -m venv venv
    source venv/bin/activate  
    
  3. Install dependencies using Pipfile:
    pip install pipenv
    pipenv install
    
  4. Build and test the package:
    python setup.py sdist bdist_wheel
    python -m unittest discover
    

Team

PyPI

This package is also available on PyPI:

stringmanipulate

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stringmanipulate-0.0.3.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stringmanipulate-0.0.3-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file stringmanipulate-0.0.3.tar.gz.

File metadata

  • Download URL: stringmanipulate-0.0.3.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for stringmanipulate-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c3787215529a165b28653752fe1548a88cdc598e5fc718cb8b81231f93c1d8d8
MD5 29cc2012e83ad13cb4150a024e8efd2d
BLAKE2b-256 ee1e5fad73ad1d32011d267c734bf792edcdc2481a5dc08f181eda30dd4827a6

See more details on using hashes here.

File details

Details for the file stringmanipulate-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for stringmanipulate-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 860e5b123d09925f7a4896180431a5230e36dc14cba5335c3a34d99db0369e99
MD5 339ae58b8f0b663db6e8264626308501
BLAKE2b-256 5a38a66b95a58a7fc6187744c55c6c26321ac08f9d741386976736fe00cc0d54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page