String Implementations

Last updated: 2nd Dec, 2020

Unique String

Module:string_algorithms()
Method : isUnique(str1,hint=False)
Uses : This method is used in checking if all the characters in a given string are unique & returns boolean
Parameters : str1 - a string, hint is passed False by default, by declaring hint=True a detailed description of the string algorithm can be found.

Python Code Example
from edualgo import algorithms as al
ping = al.string_algorithms()

str1 = "abcde"
ping.isUnique(str1)
Output:
True


    
For getting the hint just pass hint=True in the function like - isUnique(str1,True).

Permutation Checking

Module:string_algorithms()
Method : isPermutation(str1,str2,hint=False)
Uses :This method is used in checking if one string is consisting of the permutation of the characters in the other string & returns a boolean
Parameters : str1 - first string, str2 - second string, hint is passed False by default, by declaring hint=True a detailed description of the string algorithm can be found.

Python Code Example
from edualgo import algorithms as al
ping = al.string_algorithms()

str1 = "abcde"
str2 = "ecbda"

ping.isPermutation(str1,str2)
Output:
True

    
For getting the hint just pass hint=True in the function like - isPermutation(str1,str2,True).

URL Making

Module:string_algorithms()
Method : URLify(str1,key,hint=False)
Uses :This method is used for making a URL by replacing the white spaces with a key value entered & returns a string
Parameters : str1 - a string, key : replacement for the whitespace, hint is passed False by default, by declaring hint=True a detailed description of the string algorithm can be found.

Python Code Example
from edualgo import algorithms as al
ping = al.string_algorithms()

str1 = "eduAlgo is an opensource organization"
key = "%20"

ping.URLify(str1,key)
Output:
'eduAlgo%20is%20an%20opensource%20organization'

    
For getting the hint just pass hint=True in the function like - URLify(str1,key,True).

Palindromic Permutation

Module:string_algorithms()
Method : isPalindromicPermutation(str1,hint=False)
Uses :This method can be used to check if the permutation of the characters in a string can make it palindromic & return boolean
Parameters : str1 - a string, hint is passed False by default, by declaring hint=True a detailed description of the string algorithm can be found.

Python Code Example
from edualgo import algorithms as al
ping = al.string_algorithms()

str1 = "abbcad"

ping.isPalindromicPermutation(str1)
Output:
False

    
For getting the hint just pass hint=True in the function like - isPalindromicPermutation(str1,True).

One Edit Away

Module:string_algorithms()
Method : oneEditAway(str1,str2,hint=False)
Uses :Check if two strings are one edit (or zero) away,& returns boolearn, where edit means the following three methods,
- inserting a character
- removing a character
- replacing a character
Parameters : str1 - first string, str2 - second string, hint is passed False by default, by declaring hint=True a detailed description of the string algorithm can be found.

Python Code Example
from edualgo import algorithms as al
ping = al.string_algorithms()

str1 = "abbcad"
str2 = "abbccd"

ping.oneEditAway(str1,str2)
Output:
True

    
For getting the hint just pass hint=True in the function like - oneEditAway(str1,str2,True).

Compressed Strings

Module:string_algorithms()
Method : compressedString(str1,hint=False)
Uses :To compress the size of string by making a summary of the repeatation of the characters & returns the compressed string. Note that the compressed string is returned only if it's size is less than the original input string.
Parameters : str1 - a string, hint is passed False by default, by declaring hint=True a detailed description of the string algorithm can be found.

Python Code Example
from edualgo import algorithms as al
ping = al.string_algorithms()

str1 = "aabbcccdddeeef"

ping.compressedString(str1)
Output:
'a2b2c3d3e3f1'

    
For getting the hint just pass hint=True in the function like - compressedString(str1,True).

Are you an ambitious Python Developer ?

Instance Theme

Do you want to contribute to our project ? We welcome every python lover to come forwards and have some fun with our source code. Steps to contibute:

  • Send an email to the developer here regarding your willingness to contribute to the project.
  • Have a read of our "How To Contribute" documentation here.
Keep coding, keep loving python