String

String

** Strings are values for handling characters in programming. ** **

To generate a string, ** double quote the character ** Alternatively, enclose it in ** single quotes'**. See the example below.

[Example] Ruby file


"This is string."

'This is string, too.'

As you can see, strings are easy to generate.

Let's run the following code in irb

Let's write a Ruby string in irb and execute it.

Terminal


#Start irb
% irb

irb


#Write a string and execute with the enter key
irb(main):001:0> "Hello!Hello!"

#If it continues to be displayed like this, it is successful
=> "Hello!Hello!"

** If double-byte spaces or Japanese are included, the program will generate an error, If you treat it as a string value, no error will occur. ** **

Summary

** A character string is a value for handling characters in programming. ** **

that's all.

Recommended Posts

String
String puzzle
Java string
String replacement
Liar String
java.lang Summary 2 (String)
String Buffer practice
[Java] String padding
MyBatis string comparison
Java string processing
String class methods
Split string (Java)
Delete any string
String manipulation Excel function
String and stringbuffer and string builder
String literals and instances
[Java] String comparison and && and ||
Uri → String, String → Uri type conversion
Java string multiple replacement
[Note] Java: String search
[Note] Java: String survey
About Java String class
Leet string conversion program
Null, empty string, blank
Various Ruby string operations