Quick Code Question

Something Everyone talks about...but never remembers

Page 1 of 1

8 Replies - 1361 Views - Last Post: 28 October 2001 - 10:56 PM Rate Topic: -----

#1 VxJasonxV  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 201
  • Joined: 03-October 01

Quick Code Question

Posted 20 October 2001 - 05:10 PM

Got a question for any C++ers who know a lot of different code functions.
I'm not sure if I should be just asking this outright, but, here goes:

A few different people have been talking about some code that takes any string, autmatically makes it lower case no matter how you type it, and then stores it as that.
ex:

answer="I aM OnE LeEt PeRsOn"
I know that's a dumb example...but I'm just using it for example purposes.
Then, you run the answer variable through a process, and it becomes:
answer="i am one leet person"
You guys understand what I'm saying?  And can you help?

Is This A Good Question/Topic? 0
  • +

Replies To: Quick Code Question

#2 Null and Void  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 204
  • Joined: 29-April 01

Re: Quick Code Question

Posted 20 October 2001 - 07:22 PM

Lookup tolower, that's the standard way. You'll need to know how to pointer increment or use strlen also (pointer incrementing is more efficient, that's why I bring it up). Otherwise write a program to show you ASCII values of letters, take a look at the ASCII values of 'a', 'b', 'A', and 'B'. See how easy it is to write your own tolower? :)
Was This Post Helpful? 0
  • +
  • -

#3 VxJasonxV  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 201
  • Joined: 03-October 01

Re: Quick Code Question

Posted 21 October 2001 - 12:35 AM

I'm to lazy to do that though...but I'll look it up.
Was This Post Helpful? 0
  • +
  • -

#4 runtime error  Icon User is offline

  • Lucky.Code
  • member icon

Reputation: 3
  • View blog
  • Posts: 629
  • Joined: 19-March 01

Re: Quick Code Question

Posted 21 October 2001 - 01:46 AM

yes tolower is the way to go.

also you can make everything uppercase with toupper i believe.

For begginners i would suggest using strlen. because pointers can get scary.:)

Was This Post Helpful? 0
  • +
  • -

#5 Mist  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 10-April 01

Re: Quick Code Question

Posted 21 October 2001 - 05:35 AM

Just like, according to Linus Torvalds, the memory management of the PowerPC processor can be used to scare small children?

Sorry, couldn't resist the urge...

Oh, by the way - does anyone have a resource online that'll help me get started with C++? (I have MS Visual C++ 6.0 here and want to put it to some use...)

-Mist

Was This Post Helpful? 0
  • +
  • -

#6 Null and Void  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 204
  • Joined: 29-April 01

Re: Quick Code Question

Posted 21 October 2001 - 02:06 PM

C++: http://www.cplusplus.com/doc/tutorial/
C: http://www.graylab.a...oc/tutorials/C/
Was This Post Helpful? 0
  • +
  • -

#7 Null and Void  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 204
  • Joined: 29-April 01

Re: Quick Code Question

Posted 21 October 2001 - 02:08 PM

Well it looks like the C tutorial doesn't exist anymore, just ignore that :p.
Was This Post Helpful? 0
  • +
  • -

#8 VxJasonxV  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 201
  • Joined: 03-October 01

Re: Quick Code Question

Posted 28 October 2001 - 08:34 PM

wow...toupper and tolower is EASY...what's strlen?
Was This Post Helpful? 0
  • +
  • -

#9 Null and Void  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 204
  • Joined: 29-April 01

Re: Quick Code Question

Posted 28 October 2001 - 10:56 PM

The strlen function finds the length of a NULL terminated string. All stings you'll be using are NULL terminated, which means the last character is '' (a.k.a. 0 and NULL).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1