Git Product home page Git Product logo

text-shorten's Introduction

Text Shortener

This is a text shortener that reduces the length of any string to either 6 or 7 characters. See below for explanation of the algorithm used.

Link

client - https://link-shorten-client-b.web.app/
server - https://link-short-server-b.herokuapp.com/

Algorithm

The algorithm works by dividing the string into a number of segments. We then calculate the ASCII for each segment and then divide by a prime number. The code is converted back to characters

Steps

  • Calculate length of input string
  • Calculate length of each segment by dividing length of string by number of segments
  • Calculate the number of remaining characters by length of string modulo number of segments
  • For each segment, calculate the sum of ASCII codes of each individual segment
  • Divide the sum by a prime number
  • If the result is less than 33, add 33 to the result
  • Convert the resultant code back to character
  • Append the character to the output string
  • If there is a remainder, then perform the above steps and append the result to the output string

Components

The src folder contains the code for both, the client and the server

Client

Built using the React framework
Libraries used:

  • Axios: for network requests

Server

Built using Express framework

Tests

BurhanuddinUdaipurwala ThisIsATestString

text-shorten's People

Contributors

burhanuday avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.