Code Monkey home page Code Monkey logo

twitsplit's Introduction

Description

The product Tweeter allows users to post short messages limited to 50 characters each. Sometimes, users get excited and write messages longer than 50 characters. Instead of rejecting these messages, we would like to add a new feature that will split the message into parts and send multiple messages on the user's behalf, all of them meeting the 50 character requirement.

Example

Suppose the user wants to send the following message: "I can't believe Tweeter now supports chunking my messages, so I don't have to do it myself." This is 91 characters excluding the surrounding quotes. When the user presses send, it will send the following messages: "1/2 I can't believe Tweeter now supports chunking" "2/2 my messages, so I don't have to do it myself." Each message is now 49 characters, each within the allowed limit.

**note: Be aware that these count toward the character limit.

Project Focus

Result returned from Slip message function in project is a List message with multiple part.

ex: ["1/2 I can't believe Tweeter now supports chunking", "2/2 my messages, so I don't have to do it myself."]

  1. Split message function: Using recursive, re-calculate total part, re-render prefix indicator. Here

  2. Unit Test Here

  3. MVP Architecture.

  4. Message Screen: send and display message.

Implementing the app

in your project, you separate the message into multipe part by splitMessage() method of StringUtils class. The splitMessage() is a static method and can check the message error and error code to display an error message on UI.

       try {
           List<String> list = StringUtils.splitMessage(message, CHARACTER_LIMIT);
           ...
       } catch (StringUtils.SplitMessageException e) {
           e.printStackTrace();
           ....
       }

License

Copyright (C) 2018 taindb

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

twitsplit's People

Contributors

taindb avatar

Watchers

James Cloos 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.