Code Monkey home page Code Monkey logo

ruby-utility-script's Introduction

Ruby Utility Script

This Ruby utility script provides a range of useful functions for common tasks. It serves as a handy toolbox for Ruby developers, offering functions for string manipulation, file operations, and more.

Functions

  1. ReverseString: Reverses the characters in a given string.

    reversed_string = reverse_string('Hello, World!')
  2. GenerateRandomString: Generates a random string of a specified length.

    random_string = generate_random_string(10)
  3. CountWords: Counts the number of words in a given string.

    word_count = count_words('This is a sample sentence.')
  4. ReadFileContent: Reads the content of a file and returns it as a string.

    file_content = read_file_content('example.txt')
  5. WriteToFile: Writes content to a file or creates a new file if it doesn't exist.

    write_to_file('example.txt', 'This is some content.')
  6. CalculateFactorial: Calculates the factorial of a given number.

    factorial_result = calculate_factorial(5)
  7. IsPalindrome: Checks if a given string is a palindrome.

    is_palindrome = is_palindrome?('level')
  8. SortArray: Sorts an array of numbers in ascending order.

    sorted_array = sort_array([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5])
  9. EncryptString: Encrypts a string using a simple encryption algorithm.

    encrypted_string = encrypt_string('secret')
  10. DecryptString: Decrypts a previously encrypted string.

    decrypted_string = decrypt_string(encrypted_string)

Usage

  1. Clone the repository to your local machine.
  2. Execute the script using a Ruby interpreter.
  3. Utilize the functions as needed in your Ruby projects.

License

This project is licensed under the MIT License - see the LICENSE file for details.

ruby-utility-script's People

Contributors

croakieee 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.