Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > generate a random lowercase letter

Reply
Thread Tools

generate a random lowercase letter

 
 
Tris Orendorff
Guest
Posts: n/a
 
      08-07-2005
"Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in news:(E-Mail Removed):

>>How can i generate a random lowercase letter?

>
> You can generate random integer between 0 and 23 and convert it to the
> corresponding lowercase letter.
>


Ahem! As the founding member of the "Don't Forget About 'y' and 'z' at the End of the Alphabet" society I must
formally lodge a complaint. Just a reminder that the next meeting is to be held at the:

General Assembly Hall
UN Headquarters,
New York, NY
14-September-2005
19:00-21:30.

--

Sincerely,

Tris Orendorff
[Two antennae meet on a roof, fall in love and get married. The ceremony wasn't much, but the reception
was excellent.]

 
Reply With Quote
 
 
 
 
steve
Guest
Posts: n/a
 
      08-07-2005
On Sun, 7 Aug 2005 13:01:22 +0800, Andrew Thompson wrote
(in article <jzj9j067almg.1x28jbubv6cxe$(E-Mail Removed)>):

> On Sun, 07 Aug 2005 04:08:39 GMT, twink via JavaKB.com wrote:
>
>> Sergey B wrote:
>>>> How can i generate a random lowercase letter?

> ..
>> I was actually trying to convert the String into its corresponding Int
>> value,
>> say from "a" to 72

>
> Where does '72' come from?
> <http://www.physci.org/codes/char.jsp?char=97>
> <http://www.physci.org/codes/char.jsp?char=65>
>
>


The same place that , the answer to the universe and everything is 49

but that said it's seems his question is not at all related to what he
initially wants.

How can i generate a random lowercase letter?

I was actually trying to convert the String into its corresponding Int
value, say from "a" to 72

the 2 questions are totally unrelated, but you can bet he will have question
3.

 
Reply With Quote
 
 
 
 
anal_aviator
Guest
Posts: n/a
 
      08-07-2005
On Mon, 8 Aug 2005 05:29:39 +0800, Kerry Soileau wrote
(in article <73vJe.108505$(E-Mail Removed)>):

> Rubbish, you have no authority here.
>
>
> "Andrew Thompson" <(E-Mail Removed)> wrote in message
> news:jx5vvepfmmwo$(E-Mail Removed)...
>> On Sat, 06 Aug 2005 18:13:03 GMT, twink via JavaKB.com wrote:
>>
>>> How can i generate a random lowercase letter? And also how can I convert
>>> a
>>> String to int?

>>
>> This is not a help desk.
>> <http://www.physci.org/codes/javafaq.jsp#homework>
>>
>> Such beginner questions are better answered at..
>> <http://www.physci.org/codes/javafaq.jsp#cljh>
>>
>> And if you are really having difficulty knowing where
>> to start, check here..
>> <http://www.physci.org/codes/javafaq.jsp#start>
>> ..as Patricia Shanahan has just the advice you need.
>>
>> Since you are probably under some misapprehensions about
>> the Usenet Newsgroup to which you are posting..
>> <http://www.physci.org/codes/javafaq.jsp#usenet>
>>
>> In fact, you would benefit from reading the entire FAQ.
>>
>> --
>> Andrew Thompson
>> physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
>> == Proudly Made On Earth ==

>
>


tell you what "Kerry", for the next month you can answer every lame newbie
question posted , without ever complaining.
Including the ones :
1.can you do my homework for me.
2. can you teach me java without me actually doing any work.

otherwise STFU.

 
Reply With Quote
 
Thomas Hawtin
Guest
Posts: n/a
 
      08-08-2005
Tris Orendorff wrote:
> "Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in news:(E-Mail Removed):
>
>>You can generate random integer between 0 and 23 and convert it to the
>>corresponding lowercase letter.

>
> Ahem! As the founding member of the "Don't Forget About 'y' and 'z' at the End of the Alphabet" society I must
> formally lodge a complaint. Just a reminder that the next meeting is to be held at the:


You are assuming the locale is not set to greek or something weird and
foreign.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      08-08-2005
Joan wrote:
>
> "Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> >I was actually trying to convert the String into its >corresponding

>> Int value,
>>
>>> say from "a" to 72

>>
>>
>> You can simply cast it to a short integer.
>>
>> short charIndex = (short)myCharacter;
>>

> or
> int i = "a".charAt(0)


Is this a joke? Or do you really think that the code you posted is
better than that you quoted?

Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      08-08-2005
Thomas Hawtin wrote:
> Tris Orendorff wrote:
>
>> "Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in
>> news:(E-Mail Removed):
>>
>>> You can generate random integer between 0 and 23 and convert it to the
>>> corresponding lowercase letter.

>>
>>
>> Ahem! As the founding member of the "Don't Forget About 'y' and 'z'
>> at the End of the Alphabet" society I must formally lodge a
>> complaint. Just a reminder that the next meeting is to be held at the:

>
>
> You are assuming the locale is not set to greek or something weird and
> foreign.
>
> Tom Hawtin


I think we should file a RFE with Sun to get
Locale.getNumberOfLowercaseLetters() added.

Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Joan
Guest
Posts: n/a
 
      08-08-2005

"Raymond DeCampo" <(E-Mail Removed)> wrote in message
news:M9yJe.3701$(E-Mail Removed)...
> Joan wrote:
>>
>> "Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>
>>> >I was actually trying to convert the String into its
>>> > >corresponding
>>> Int value,
>>>
>>>> say from "a" to 72
>>>
>>>
>>> You can simply cast it to a short integer.
>>>
>>> short charIndex = (short)myCharacter;
>>>

>> or
>> int i = "a".charAt(0)

>
> Is this a joke? Or do you really think that the code you
> posted is better than that you quoted?
>
> Ray


If you mean "short charIndex = (short)myCharacter;"
it does not meet the requirements.
The OP says for "string" not "char"
If you put myString for myCharacter, it doesn't compile.

 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      08-08-2005
Joan wrote:
>
> "Raymond DeCampo" <(E-Mail Removed)> wrote in message
> news:M9yJe.3701$(E-Mail Removed)...
>
>> Joan wrote:
>>
>>>
>>> "Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>
>>>> >I was actually trying to convert the String into its > >corresponding
>>>> Int value,
>>>>
>>>>> say from "a" to 72
>>>>
>>>>
>>>>
>>>> You can simply cast it to a short integer.
>>>>
>>>> short charIndex = (short)myCharacter;
>>>>
>>> or
>>> int i = "a".charAt(0)

>>
>>
>> Is this a joke? Or do you really think that the code you posted is
>> better than that you quoted?
>>
>> Ray

>
>
> If you mean "short charIndex = (short)myCharacter;"
> it does not meet the requirements.
> The OP says for "string" not "char"
> If you put myString for myCharacter, it doesn't compile.


OK, I misunderstood. I think it would have been clearer if you used a
variable to represent the String in your example, because as it stands,
it looks ridiculous.

Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Joan
Guest
Posts: n/a
 
      08-08-2005

"Raymond DeCampo" <(E-Mail Removed)> wrote in message
news:NHzJe.5807$(E-Mail Removed)...
> Joan wrote:
>>
>> "Raymond DeCampo" <(E-Mail Removed)> wrote in message
>> news:M9yJe.3701$(E-Mail Removed)...
>>
>>> Joan wrote:
>>>
>>>>
>>>> "Sergey B via JavaKB.com" <(E-Mail Removed)> wrote in
>>>> message news:(E-Mail Removed)...
>>>>
>>>>> >I was actually trying to convert the String into its >
>>>>> > >corresponding
>>>>> Int value,
>>>>>
>>>>>> say from "a" to 72
>>>>>
>>>>>
>>>>>
>>>>> You can simply cast it to a short integer.
>>>>>
>>>>> short charIndex = (short)myCharacter;
>>>>>
>>>> or
>>>> int i = "a".charAt(0)
>>>
>>>
>>> Is this a joke? Or do you really think that the code you
>>> posted is better than that you quoted?
>>>
>>> Ray

>>
>>
>> If you mean "short charIndex = (short)myCharacter;"
>> it does not meet the requirements.
>> The OP says for "string" not "char"
>> If you put myString for myCharacter, it doesn't compile.

>
> OK, I misunderstood. I think it would have been clearer if you
> used a variable to represent the String in your example,
> because as it stands, it looks ridiculous.
>
> Ray


I agree that it looks strange the first time you see it. It is
mostly
to get people to think about "is it possible to use a string like
that?"

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      08-08-2005
On Mon, 08 Aug 2005 01:02:54 GMT, Raymond DeCampo wrote:

> I think we should file a RFE with Sun to get
> Locale.getNumberOfLowercaseLetters() added.


Nah! Be more definitive.

/** Ignores those last 'funny looking' letters in any language. */
Locale.setNumberOfLowercaseLetters(int num)

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Not Affiliated With Futurama Brass Knuckle Co.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
Re: big letter -> small letter Andrew McNamara Python 2 07-06-2004 02:09 PM
big letter -> small letter vertigo Python 4 07-06-2004 07:23 AM
RE: big letter -> small letter Tony Meyer Python 0 07-06-2004 07:11 AM



Advertisments