
-----------------------------------
Slayer
Thu Dec 15, 2005 9:19 pm

Convert Lowercase word to upper
-----------------------------------
Basically i need help with writting a program that recieves a a word and converts it to uppercase

ex. input- "Convert"
     output- "CONVERT"

i really suck in this area, hopefully someone can help me out..

-----------------------------------
[Gandalf]
Thu Dec 15, 2005 9:22 pm


-----------------------------------
Str.Upper()
Str.Lower()

or else you could always make a program that does it yourself.  If you wish to learn how and/or don't have these functions, use Cervantes' String Manipulation tutorial to write your own.

-----------------------------------
Slayer
Thu Dec 15, 2005 9:27 pm


-----------------------------------
wow amazing.. thx..

-----------------------------------
Slayer
Thu Dec 15, 2005 9:40 pm


-----------------------------------
funny, i was told to do it this way by someone else..
find the length 
compare each individual letter to see if its capitol or not
	if its capitol add that character to the newWord
newWord:= newWord + word(i)
	if it is not capitol convert to capitols and add it to the newWord 
newWord := newWord +ch(ord(word(i))-32)

i must say, i like your way much better

-----------------------------------
[Gandalf]
Thu Dec 15, 2005 9:50 pm


-----------------------------------
No problem.  Well, the way I posted just does the same thing but it is premade.  As wtd sometimes says "Don't reinvent the wheel if theres an existing library function to do it for you."  This is the case for Str.Upper(), although you might benefit from learning how it works and why.

Here's the real function:
    function Upper (s : string) : string
        var res : string := ""
        for i : 1 .. length (s)
            if "a" 