PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > What is ?E in str.index(?E)...
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
What is ?E in str.index(?E)...

Réponse
 
LinkBack Outils de la discussion
Vieux 27/05/2008, 04h39   #1
askingagain
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut What is ?E in str.index(?E)...

Dear all
I am learning Ruby. "The Ruby Way" has following example.

irb(main):047:0> str = "Albert Einstein"
=> "Albert Einstein"
irb(main):048:0> str.index(?E)
=> 7
irb(main):049:0> str1 = "mathematics"
=> "mathematics"
irb(main):050:0> flag1 = str1.include? ?e
=> true
irb(main):051:0>

What is ?E

(Does ? above work like shell globbing?)

I tried the FAQ online but could not get anything..

TIA for any pointers/online

-- thx atul
  Réponse avec citation
Vieux 27/05/2008, 04h52   #2
ara.t.howard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: What is ?E in str.index(?E)...


On May 26, 2008, at 9:39 PM, askingagain wrote:

> Dear all
> I am learning Ruby. "The Ruby Way" has following example.
>
> irb(main):047:0> str = "Albert Einstein"
> => "Albert Einstein"
> irb(main):048:0> str.index(?E)
> => 7
> irb(main):049:0> str1 = "mathematics"
> => "mathematics"
> irb(main):050:0> flag1 = str1.include? ?e
> => true
> irb(main):051:0>
>
> What is ?E
>
> (Does ? above work like shell globbing?)
>
> I tried the FAQ online but could not get anything..
>
> TIA for any pointers/online
>
> -- thx atul
>



cfp:~ > cat a.rb
p ?A
p 'A'[0]
p 65.chr



cfp:~ > ruby a.rb
65
65
"A"

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




  Réponse avec citation
Vieux 27/05/2008, 06h43   #3
Kam-Hung Soh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: What is ?E in str.index(?E)...

askingagain wrote:
> Dear all
> I am learning Ruby. "The Ruby Way" has following example.
>
> irb(main):047:0> str = "Albert Einstein"
> => "Albert Einstein"
> irb(main):048:0> str.index(?E)
> => 7
> irb(main):049:0> str1 = "mathematics"
> => "mathematics"
> irb(main):050:0> flag1 = str1.include? ?e
> => true
> irb(main):051:0>
>
> What is ?E
>
> (Does ? above work like shell globbing?)
>
> I tried the FAQ online but could not get anything..
>
> TIA for any pointers/online
>
> -- thx atul


See: http://www.ruby-doc.org/docs/Program..._stdtypes.html

"You can also get the integer value corresponding to an ASCII character
or escape sequence by preceding it with a question mark."

--
Kam-Hung Soh <a href="http://kamhungsoh.com/blog">Software Salariman</a>
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 19h21.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08436 seconds with 11 queries