Ruby Strings Programs

In Ruby, a String object has an arbitrary sequence of bytes, typically representing text or binary data. A String object may be created using String::new or as literals.

This section contains Ruby strings programs, practice these Ruby programs to learn the concept of Ruby strings, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Ruby strings programs.

List of Ruby Strings Programs

  1. Ruby program to illustrate the creation of strings
  2. Ruby program to illustrate the difference between single quote string and double-quote string
  3. Ruby program to create a String object
  4. Ruby program to find the length of a string
  5. Ruby program to get characters from a string using the index
  6. Ruby program to get a substring from the string
  7. Ruby program to demonstrate the example to write double-quotes in a string
  8. Ruby program to demonstrate the escape sequence characters
  9. Ruby program to demonstrate the string concatenation
  10. Ruby program to make string immutable
  11. Ruby program to compare two strings using the Equal To (==) operator
  12. Ruby program to compare two strings using the eql?() method
  13. Ruby program to compare two strings by ignoring case
  14. Ruby program to check the given string is empty or not
  15. Ruby program to demonstrate the string interpolation
  16. Ruby program to check a string contains a specified substring or not
  17. Ruby program to get the index of the substring in a string
  18. Ruby program to pad a string with 0's on left side
  19. Ruby program to pad a string with 0's on the right side
  20. Ruby program to convert a string into uppercase
  21. Ruby program to convert a string into lowercase
  22. Ruby program to trim a string from both sides
  23. Ruby program to trim a string from the left side
  24. Ruby program to trim a string from the right side
  25. Ruby program to check a string starts with a specified substring
  26. Ruby program to check a string end with a specified substring
  27. Ruby program to delete suffix substring from the given string
  28. Ruby program to delete prefix substring from the given string
  29. Ruby program to convert the string into an array of characters
  30. Ruby program to convert the string into an array of characters based on the specified character
  31. Ruby program to convert the array of characters into the string
  32. Ruby program to convert an integer array into a string
  33. Ruby program to convert a numeric string into integer using to_i() function
  34. Ruby program to check a string is a numeric string or not using the match() function
  35. Ruby program to concatenate the strings using the << operator
  36. Ruby program to iterate characters using the each_char() function
  37. Ruby program to convert the string into an array of characters using chars() function
  38. Ruby program to create a multi-line string using '%Q'
  39. Ruby program to replace text inside the string using gsub() method
  40. Ruby program to remove a specified character inside the string using gsub() method
  41. Ruby program to replace number within a string using gsub() method with regular expression
  42. Ruby program to convert the string into title case using gsub() method
  43. Ruby program to remove the last specified character from the string
  44. Ruby program to count a specified character inside the string

ADVERTISEMENT
ADVERTISEMENT




Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.