我需要发现一个字符串的第一个元素是否是char。 例子:如何判断Ruby字符串以什么开头?
string_1 = "Smith has 30 years" -----> TRUE (first element is a character)
string_2 = "20/12/2013 Good Day" -----> FALSE (first element is not a character)
string_3 = "<My name is John>" -----> FALSE (first element is not a character)
使用“.initial”我能够获得每个字符串的第一个元素,但我不知道做测试
字符串的任何元素为_character_,也许你说的是_letter_? – toro2k