No release in over a year
IprogStringUtils is a Ruby gem that provides a set of string manipulation utilities. These utilities include methods for converting strings to different cases such as camelCase, snake_case, and kebab-case, truncating strings with an ellipsis, reversing the order of words, stripping HTML tags, and more. This gem is designed to enhance the functionality of the Ruby String class with common string operations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Iprog String Utils

IprogStringUtils is a Ruby gem that extends the String class with a set of useful string manipulation utilities. It includes methods for converting strings to various cases, truncating strings, reversing words, stripping HTML tags, and more.

IPROG TECH

This gem is provided by IPROG TECH, an information technology company specializing in web development services using Ruby on Rails. IPROG TECH also offers free programming tutorials.

Providing Good Quality Web Services:

  • Startup
  • Maintenance
  • Upgrading & Conversion

Getting Started

Installation

To install the gem and add it to your application's Gemfile, run on your terminal:

bundle add iprog_string_utils

If you're not using Bundler to manage dependencies, install the gem by running:

gem install iprog_string_utils

Features

  • Convert strings to camelCase, snake_case, and kebab-case
  • Truncate strings with an ellipsis
  • Reverse the order of words in a string
  • Strip HTML tags from strings
  • Check if a string is a palindrome
  • And more!

Usage

camel case

"hello world".camel_case
=> "helloWorld"

"Hello World Example".camel_case
=> "helloWorldExample"

snake case

"ThisIsATest".snake_case
=> "this_is_a_test"

"Hello World Example".snake_case
=> "hello_world_example"

kebab case

"Hello World!".kebab_case
=> "hello-world"

"ThisIsAnotherTest".kebab_case
=> "this-is-another-test"

truncate a string with ellipsis or custom

"This is a very long string".truncate(10)
=> "This is a..."

"This is a long string".truncate(15, '--')
=> "This is a lon--"

reverse the order of words

"hello world".reverse_words
=> "world hello"

"one two three".reverse_words
=> "three two one"

strip html tags

"<p>Hello <strong>world</strong>!</p>".strip_html
=> "Hello world!"

"<div>Some <em>text</em></div>".strip_html
=> "Some text"

check if a string is a palindrome

"madam".palindrome?
=> true

"racecar".palindrome?
=> true

"hello".palindrome?
=> false

"A man, a plan, a canal, Panama".palindrome?
=> true

trim custom characters

"...hello...".trim_custom('.')
=> "hello"

"$$$money$$$".trim_custom('$')
=> "money"

"###header###".trim_custom('#')
=> "header"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/iprog21/iprog_string_utils.

License

This gem is available as open source under the terms of the MIT License.

Code of Conduct

This project has adopted the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to iprog.tech@gmail.com.