DEV Community

Felix Imbanga
Felix Imbanga

Posted on

String and Date classes

String Class
Formal way to create a new object is with the .new method
.concat method accepts a number as a method, interprets it as an ASCII code, translates it from a single character, and adds it to the end of an original story.
.concat can be replaced with +, you can also drop the ., as well as the parenthesis.

Data Class
Arguments within pp p print or puts need to be seperated with a comma or with interpolation. Date.parse() accepts a string and converts it to a Date object.

String Interpolation + printing
Alternative to .to_s
Easier when it comes to composing strings
Only double quotes interpolate
pp shows the gory technical details, which is usually what you want when debugging code. It calls inspect on whatever object you give it. backend?
puts calls a method .to_s on whichever object you give it. Better for human interaction, frontend?
\n represents a new paragraph or line break. An active character.
\s represents a space between within a line.
Single quotes within double quotes is one way to include a string within a string.
If you want double quotes you need to use the escape character backslash.

"\"Felix\"" ---> "Felix"
The \ before " says treat this next quotation as a character not as the string literal syntactic sugar.
ms = multiline string as long there is one opening and closing quote.

Tiugo image

Modular, Fast, and Built for Developers

CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.

Start now

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay