Convert PHP code into Ruby!
RSS icon Email icon Home icon
  • is_string

    Posted on August 12th, 2009 RubyLove No comments

    The is_string() function allows you to check if a particular variable is a string (type).

    PHP

    $string1 = 'Hello World';
    var_dump( is_string($string1) );
    // => true

    Ruby

    string1 = 'Hello World';
    puts string1.is_a?(String);
    # => true

    Leave a reply